]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/convertrules.py
* mf/feta-bolletjes.mf (solfa_quarter_width): use
[lilypond.git] / python / convertrules.py
index d670696b765c7b5a92d18f9cccaf3140aa7d28d5..40a8300e730d252f19c75d14533443346581145e 100644 (file)
@@ -623,13 +623,13 @@ def conv (str):
            lastx = x
        return s
 
-       def regularize_dollar_reference (match):
-           return regularize_id (match.group (1))
-       def regularize_assignment (match):
-           return '\n' + regularize_id (match.group (1)) + ' = '
-       str = re.sub ('\$([^\t\n ]+)', regularize_dollar_reference, str)
-       str = re.sub ('\n([^ \t\n]+)[ \t]*= *', regularize_assignment, str)
-       return str
+    def regularize_dollar_reference (match):
+       return regularize_id (match.group (1))
+    def regularize_assignment (match):
+       return '\n' + regularize_id (match.group (1)) + ' = '
+    str = re.sub ('\$([^\t\n ]+)', regularize_dollar_reference, str)
+    str = re.sub ('\n([^ \t\n]+)[ \t]*= *', regularize_assignment, str)
+    return str
 
 conversions.append (((1,3,117), conv, 'identifier names: $!foo_bar_123 -> xfooBarABC'))
 
@@ -2795,7 +2795,7 @@ def conv (str):
     str = re.sub (r'\\context\s+\"?([a-zA-Z]+)\"?\s*\\applyOutput', r"\\applyOutput #'\1", str)
     return str
 
-conversions.append (((2, 9, 6), conv, """\context Foo \applyOutput #bla -> \applyOutput #'Foo #bla """))
+conversions.append (((2, 9, 6), conv, """\context Foo \\applyOutput #bla -> \\applyOutput #'Foo #bla """))
 
 
 def conv (str):
@@ -2826,9 +2826,46 @@ conversions.append (((2, 9, 11), conv, """\\set tupletNumberFormatFunction -> \\
 
 def conv (str):
     str = re.sub ('vocNam', 'shortVocalName', str)
-    str = re.sub (r'([^a-z])instr\s*=', r'\1shortInstrumentName =', str)
-    str = re.sub (r'([^a-z])instrument\s*=', r'\1instrumentName =', str)
+    str = re.sub (r'\.instr\s*=', r'.shortInstrumentName =', str)
+    str = re.sub (r'\.instrument\s*=', r'.instrumentName =', str)
     return str
 
 conversions.append (((2, 9, 13), conv, """instrument -> instrumentName, instr -> shortInstrumentName, vocNam -> shortVocalName"""))
 
+
+def conv (str):
+
+    def sub_tempo (m):
+        dur = int (m.group (1))
+        dots = len (m.group (2))
+        count = int (m.group (3))
+
+        log2 = 0
+        while dur > 1 :
+            dur /= 2
+            log2 += 1
+        
+        den = (1 << dots) * (1 << log2)
+        num = ((1 << (dots+1))  - 1)
+
+        return  """
+  \midi {
+    \context {
+      \Score
+      tempoWholesPerMinute = #(ly:make-moment %d %d)
+      }
+    }
+
+""" % (num*count, den)
+    
+    str = re.sub (r'\\midi\s*{\s*\\tempo ([0-9]+)\s*([.]*)\s*=\s*([0-9]+)\s*}', sub_tempo, str)
+    return str
+
+conversions.append (((2, 9, 16), conv, """deprecate \\tempo in \\midi"""))
+
+def conv (str):
+    str = re.sub ('printfirst-page-number', 'print-first-page-number', str)
+    return str
+
+conversions.append (((2, 9, 19), conv, """printfirst-page-number -> print-first-page-number"""))
+