From 83460541644c33c1f0647868cc9096078f735681 Mon Sep 17 00:00:00 2001
From: Keith OHara <k-ohara5a5a@oco.net>
Date: Sat, 19 Oct 2013 09:54:56 -0700
Subject: [PATCH] key-signature: restore function for LilyJAZZ.ily; issue 3606

key-signature-interface::alteration-position
---
 scm/output-lib.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index dc88b4387a..02170918a1 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -673,6 +673,20 @@ and duration-log @var{log}."
                                     (prepend (+ x 7) (cons x l))))
           (prepend first-position '())))))
 
+(define-public (key-signature-interface::alteration-position
+                step alter c0-position)
+;; Deprecated.  Not a documented interface, and no longer used in LilyPond,
+;; but needed for a popular file, LilyJAZZ.ily for version 2.16
+  (if (pair? step)
+    (+ (cdr step) (* (car step) 7) c0-position)
+    (let* ((c-pos (modulo c0-position 7))
+           (hi (list-ref
+                 (if (< alter 0)
+                   '(2 3 4 2 1 2 1) ; position of highest flat
+                   '(4 5 4 2 3 2 3)); position of highest sharp
+                 c-pos)))
+      (- hi (modulo (- hi (+ c-pos step)) 7)))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; annotations
 
-- 
2.39.5