import re
import time
-lilypond_version_re_str = '\\\\version *\"(.*)\"'
-lilypond_version_re = re.compile(lilypond_version_re_str)
+# Did we ever have \mudela-version? I doubt it.
+# lilypond_version_re_str = '\\\\version *\"(.*)\"'
+lilypond_version_re_str = '\\\\(mudela-)?version *\"(.*)\"'
+lilypond_version_re = re.compile (lilypond_version_re_str)
def program_id ():
return '%s (GNU LilyPond) %s' %(program_name, version);
return t1[x] - t2[x]
return 0
-def guess_lilypond_version(filename):
+def guess_lilypond_version (filename):
s = gulp_file (filename)
m = lilypond_version_re.search (s)
if m:
- return m.group(1)
+ return m.group (2)
else:
return ''
if 1:
def conv(str):
str = re.sub ('\\\\melodic', '\\\\notes',str)
+ if re.search ('\\\\header', str):
+ sys.stderr.write ('\nNot smart enough to convert \\multi constructs')
return str
if 1:
def conv(str):
str = re.sub ('default_paper *=', '',str)
- str = re.sub ('default_midi *=', '',x)
-
+ str = re.sub ('default_midi *=', '',str)
return str
conversions.append (((1,0,4), conv, 'default_{paper,midi}'))
str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?timeSignatureStyle"? *= *"([^"]*)"', '\\\\property \\1.TimeSignature \\\\override #\'style = #\'\\2', str)
- str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?horizontalNoteShift"? *= *"?#?([0-9]+)"?', '\\\\property \\1.NoteColumn \\\\override #\'horizonta-shift = #\\2', str)
+ str = re.sub ('"?timeSignatureStyle"? *= *#?""', 'TimeSignature \\\\override #\'style = ##f', str)
+
+ str = re.sub ('"?timeSignatureStyle"? *= *#?"([^"]*)"', 'TimeSignature \\\\override #\'style = #\'\\1', str)
+
+ str = re.sub ('#\'style *= #*"([^"])"', '#\'style = #\'\\1', str)
+
+ str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?horizontalNoteShift"? *= *"?#?([0-9]+)"?', '\\\\property \\1.NoteColumn \\\\override #\'horizontal-shift = #\\2', str)
+ # ugh
+ str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?flagStyle"? *= *""', '\\\\property \\1.Stem \\\\override #\'flag-style = ##f', str)
+
+ str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?flagStyle"? *= *"([^"]*)"', '\\\\property \\1.Stem \\\\override #\'flag-style = #\'\\2', str)
return str
conversions.append (((1,3,98), conv, 'CONTEXT.textStyle -> GROB.#font-style '))
conversions.append (((1,3,122), conv, 'drarnChords -> chordChanges, \\musicalpitch -> \\pitch'))
+if 1:
+ def conv (str):
+ str = re.sub ('ly-([sg])et-elt-property', 'ly-\\1et-grob-property', str)
+ return str
+
+ conversions.append (((1,3,136), conv, 'ly-X-elt-property -> ly-X-grob-property'))
+
+if 1:
+ def conv (str):
+ str = re.sub ('point-and-click +#t', 'point-and-click line-column-location', str)
+ return str
+
+ conversions.append (((1,3,138), conv, 'point-and-click argument changed to procedure.'))
+
+if 1:
+ def conv (str):
+ str = re.sub ('followThread', 'followVoice', str)
+ str = re.sub ('FollowThread', 'VoiceFollower', str)
+ return str
+
+ conversions.append (((1,3,138), conv, 'followThread -> followVoice.'))
+
############################
if last_conversion:
sys.stderr.write ('\n')
new_ver = '\\version \"%s\"' % tup_to_str (last_conversion)
+ # JUNKME?
+ # ugh: this all really doesn't help
+ # esp. as current conversion rules are soo incomplete
if re.search (lilypond_version_re_str, str):
str = re.sub (lilypond_version_re_str,'\\'+new_ver , str)
- else:
- str = new_ver + '\n' + str
+ #else:
+ # str = new_ver + '\n' + str
outfile.write(str)
try:
do_one_file (f)
except UnknownVersion:
+ sys.stderr.write ('\n')
+ sys.stderr.write ("%s: can't determine version for %s" % (program_name, f))
+ sys.stderr.write ('\n')
+ sys.stderr.write ("%s: skipping" % program_name)
pass
+sys.stderr.write ('\n')