lilypond-devel
[Top][All Lists]

## Re: convert-ly bug

 From: Werner LEMBERG Subject: Re: convert-ly bug Date: Sat, 24 Jan 2004 08:35:33 +0100 (CET)

```[CVS 2004-01-22 10:01 MET]

> can you see what happens if you add
>
>       def sub_slurs(m):
>
> into
>       def sub_slurs (m, slur_strs = slur_strs)

This helps.  Attached is a patch which fixes this for various
subroutines.

Anyway, there is still a serious bug in it.  This input:

\version "1.6.5"

\notes {
[a <e16^"sim." g c>]
}

produces this:

\version "2.1.13"

\notes {
a[ <<e16^"sim." g c>>]
}

Werner

======================================================================

--- convert-ly.old      Thu Jan 22 10:34:33 2004
+++ convert-ly  Sat Jan 24 08:25:59 2004
@@ -1265,7 +1265,7 @@
return origstr

durs = []
-               def sub_durs (m):
+               def sub_durs (m, durs = durs):
durs.append(m.group(2))
return m.group (1)

@@ -1285,7 +1285,7 @@
last_str = ''
while last_str <> str:
last_str = str
-                       def sub_tremolos (m):
+                       def sub_tremolos (m, slur_strs = slur_strs):
tr = m.group (2)
if tr not in slur_strs:
slur_strs.append (tr)
@@ -1294,31 +1294,31 @@
str = re.sub (r"([a-z]+[',!? ]*)(:[0-9]+)",
sub_tremolos, str)

-                       def sub_dyn_end (m):
+                       def sub_dyn_end (m, dyns = dyns):
dyns.append (' \!')
return ' ' + m.group(2)

str = re.sub (r'(\\!)\s*([a-z]+)', sub_dyn_end, str)
-                       def sub_slurs(m):
+                       def sub_slurs(m, slur_strs = slur_strs):
if '-)' not in slur_strs:
slur_strs.append (')')
return m.group(1)

-                       def sub_p_slurs(m):
+                       def sub_p_slurs(m, slur_strs = slur_strs):
if '-\)' not in slur_strs:
slur_strs.append ('\)')
return m.group(1)

str = re.sub (r"\)[ ]*([a-z]+)", sub_slurs, str)
str = re.sub (r"\\\)[ ]*([a-z]+)", sub_p_slurs, str)
-                       def sub_begin_slurs(m):
+                       def sub_begin_slurs(m, slur_strs = slur_strs):
if '-(' not in slur_strs:
slur_strs.append ('(')
return m.group(1)

str = re.sub (r"([a-z]+[,'!?0-9 ]*)\(",
sub_begin_slurs, str)
-                       def sub_begin_p_slurs(m):
+                       def sub_begin_p_slurs(m, slur_strs = slur_strs):
if '-\(' not in slur_strs:
slur_strs.append ('\(')
return m.group(1)
@@ -1326,7 +1326,7 @@
str = re.sub (r"([a-z]+[,'!?0-9 ]*)\\\(",
sub_begin_p_slurs, str)

-                       def sub_dyns (m):
+                       def sub_dyns (m, slur_strs = slur_strs):
s = m.group(0)
if s == '@STARTCRESC@':
slur_strs.append ("\\<")
@@ -1339,7 +1339,7 @@
str = re.sub (r'@STARTCRESC@', sub_dyns, str)
str = re.sub (r'-?\\!', sub_dyns, str)

-                       def sub_articulations (m):
+                       def sub_articulations (m, slur_strs = slur_strs):
a = m.group(1)
if a not in slur_strs:
slur_strs.append (a)
@@ -1352,7 +1352,7 @@
str = re.sub (r"([_^-][>_.+|^-])", sub_articulations,
str)

-                       def sub_pslurs(m):
+                       def sub_pslurs(m, slur_strs = slur_strs):
slur_strs.append (' \\)')
return m.group(1)
str = re.sub (r"\\\)[ ]*([a-z]+)", sub_pslurs, str)

```

reply via email to