begin_autometric_re = regex.compile('@{')
end_autometric_re = regex.compile('@}')
-autometric_re = regex.compile('@{\([^@]*\)@}')
-version = '0.3'
+autometric_re = regex.compile('@{\(.*\)@}')
+version = '0.4'
class File:
"""silly wrapper for Python file object."""
def readline(self):
"""return what is enclosed in one @{ @} pair"""
line = '';
- while autometric_re.match(line) == -1 and not self.eof():
+ while autometric_re.search(line) == -1 and not self.eof():
line = self.read_autometricline()
+
if self.eof():
return '';
+
return autometric_re.group(1);
def __init__(self, nm):
File.__init__(self, nm)
class Ly_file(Indentable_file):
"""extra provisions for mozarella quirks"""
def print_lit(self, str):
- self.write('\"' + str + '\" ')
+ self.write('\"%s\"\t' % str)
+
+ def print_f_dimen(self, f):
+ self.write( '%.2f\\pt\t' % f);
def print_dimen(self, str):
- self.write( '%.2f' % atof(str) + '\\pt ');
+ self.print_f_dimen(atof(str))
def neg_print_dimen(self, str):
- self.write( '%.2f' % -atof(str) + '\\pt ');
+ self.print_f_dimen(-atof(str));
+
def def_symbol(self, lily_id, tex_id, dims):
self.print_lit(lily_id)
- self.print_lit('\\' + tex_id)
+ self.print_lit('\\\\' + tex_id)
self.neg_print_dimen(dims [0])
self.print_dimen(dims [1])
class Log_reader:
"""Read logs, destill info, and put into output files"""
def output_label(self, line):
+
if not line:
return;
- tags = split(line, ':')
+ tags = split(line, '@:')
label = tags[0]
name = tags[1]
ly = self.lyfile
ly.def_symbol(id, texstr, tags[3:7])
- self.texfile.write("\\fetdef\\" + texstr + '{' + code + '}\n')
+ self.texfile.write("\\fetdef\\%s{%s}\n" % (texstr, code))
else:
raise 'unknown label: ' + label
def do_file(self,filenm):
self.lyfile.write('\n% input from ' + filenm + '\n')
- self.texfile.write('\n% input from ' + filenm + '\n')
+ self.texfile.write('\n% input from ' + filenm + '\n')
feta = Feta_file(filenm)
while not feta.eof():
line = feta.readline()
self.lyfile = Ly_file(lyfile_nm, 'w')
self.texfile = Indentable_file(texfile_nm, 'w')
- headerstr = '% generated automatically by ' + program_id()
- headerstr = headerstr + '\n% on ' + today_str()
- headerstr = headerstr + '\n% Do not edit\n'
+
+ headerstr = '%% generated automatically by %s\n%% on %s\n%% Do not edit' % \
+ (program_id(), today_str())
self.lyfile.write(headerstr)
self.texfile.write(headerstr)
% index TeXstring, xmin xmax ymin ymax
- "scripts" = \table {
- "open" "\ouvert" -1.33\pt 1.33\pt -0.00\pt 3.33\pt
- "stopped" "\plusstop" -2.75\pt 2.75\pt -2.75\pt 2.75\pt
- "fermata" "\ufermata" 0.0\pt 0.0\pt 0.0\pt 6.0\pt
- "-fermata" "\dfermata" 0.0\pt 0.0\pt -6.0\pt 0.0\pt
- "portato" "\portato" 0.0\pt 4.0\pt 0.0\pt 2.0\pt
- "-portato" "\iportato" 0.0\pt 4.0\pt -2.0\pt 0.0\pt
- "tenuto" "\utenuto" 0.0\pt 4.0\pt -1.0\pt 1.0\pt
- "-tenuto" "\dtenuto" 0.0\pt 4.0\pt -1.0\pt 1.0\pt
- "sforzato" "\sforzatoaccent" -0.8\pt 4.0\pt -1.92\pt 1.92\pt
- "marcato" "\umarcato" 0.0\pt 4.0\pt 0.0\pt 4.0\pt
- "-marcato" "\dmarcato" 0.0\pt 4.0\pt -4.0\pt 0.0\pt
- "staccato" "\staccato" 0.0\pt 0.0\pt -1.1\pt 1.1\pt
- "staccatissimo" "\ustaccatissimo" 0.0\pt 0.0\pt 0.0\pt 1.0\pt
- "-staccatissimo" "\dstaccatissimo" 0.0\pt 0.0\pt 0.0\pt 1.0\pt
- "upbow" "\upbow" -1.0\pt 6.0\pt 0.0\pt 5.0\pt
- "downbow" "\downbow" 0.0\pt 5.0\pt 0.0\pt 7.5\pt
- "back" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt
- "-front" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt
- "heel" "\heel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt
- "toe" "\toe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt
- "bheel" "\bheel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt
- "btoe" "\btoe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt
- "fheel" "\fheel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt
- "ftoe" "\ftoe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt
- "-back" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt
- "front" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt
- "turn" "\turn" -2.0\pt 7.0\pt 0.0\pt 4.0\pt
- }
-
"style" = \table {
"roman" "\settext{%}" 0.0\pt 7.5\pt 0.0\pt 10.0\pt
"italic" "\setitalic{%}" 0.0\pt 0.0\pt 0.0\pt 8.0\pt
"half" "\hslurchar%{%}" 0.0\pt 0.0\pt 0.0\pt 0.0\pt
}
- "accidentals" = \table {
- "-2" "\flatflat" 0.0\pt 10.2\pt -2.5\pt 7.5\pt
- "-1" "\flat" 0.0\pt 6.0\pt -2.5\pt 7.5\pt
- "0" "\natural" 0.0\pt 6.0\pt -7.5\pt 7.5\pt
- "1" "\sharp" 0.0\pt 6.0\pt -7.5\pt 7.5\pt
- "2" "\sharpsharp" 0.0\pt 6.0\pt -2.5\pt 7.5\pt
- }
"streepjes" = \table {
- "toplines" "\topledgerlines{%}{%}" -3.0\pt 9.0\pt 0.0\pt 0.0\pt
+ "toplines" "\\topledgerlines{%}{%}" -3.0\pt 9.0\pt 0.0\pt 0.0\pt
"botlines" "\botledgerlines{%}{%}" -3.0\pt 9.0\pt 0.0\pt 0.0\pt
}
":|:" "\repeatbarstartrepeat" 0.0\pt 16.0\pt 0.0\pt 20.0\pt
}
- "rests" = \table {
- "-1o" "\breverest" 0.0\pt 6.0\pt 0.0\pt 4.0\pt
- "-1" "\breverest" 0.0\pt 6.0\pt 0.0\pt 4.0\pt
- "0o" "\outsidewholerest" 0.0\pt 6.0\pt 0.0\pt 2.0\pt
- "0" "\wholerest" 0.0\pt 6.0\pt 0.0\pt 2.0\pt
- "1" "\halfrest" 0.0\pt 6.0\pt -2.0\pt 0.0\pt
- "1o" "\outsidehalfrest" 0.0\pt 6.0\pt -2.0\pt 0.0\pt
- "2o" "\quartrest" -5.0\pt 2.0\pt -5.0\pt 5.0\pt
- "3o" "\eighthrest" 0.0\pt 5.0\pt 0.0\pt 8.0\pt
- "4o" "\sixteenthrest" 0.0\pt 6.0\pt 0.0\pt 12.0\pt
- "2" "\quartrest" -5.0\pt 2.0\pt -5.0\pt 5.0\pt
- "3" "\eighthrest" 0.0\pt 5.0\pt 0.0\pt 8.0\pt
- "4" "\sixteenthrest" 0.0\pt 6.0\pt 0.0\pt 12.0\pt
- "5" "\thirtysecondrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt
- "6" "\sixtyfourthrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt
- "7" "\hundredtwentyeighthrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt
- }
-
"meters" = \table {
"C" "\fourfourmeter" 0.0\pt 10.0\pt -5.0\pt 5.0\pt
"C2" "\allabreve" 0.0\pt 10.0\pt -5.0\pt 5.0\pt
"decrescendosym" "\decrescendosym{%}" 0.0\pt 0.0\pt -3.0\pt 3.0\pt
}
- "dots" = \table {
- "1" "\lsingledot" 0.0\pt 8.0\pt -1.0\pt 1.0\pt
- "2" "\ldoubledot" 0.0\pt 12.0\pt -1.0\pt 1.0\pt
- "3" "\ltripledot" 0.0\pt 16.0\pt -1.0\pt 1.0\pt
- }
-
"flags" = \table {
"u3" "\eighthflag" 0.0\pt 5.0\pt 0.0\pt 0.0\pt
"u4" "\sixteenthflag" 0.0\pt 5.0\pt 0.0\pt 0.0\pt
- "u5" "\thirtysecondflag" 0.0\pt 5.0\pt 0.0\pt 0.0\pt
+ "u5" "\\thirtysecondflag" 0.0\pt 5.0\pt 0.0\pt 0.0\pt
"u6" "\sixtyfourthflag" 0.0\pt 5.0\pt 0.0\pt 0.0\pt
"u7" "\hundredtwentyeighthflag" 0.0\pt 5.0\pt 0.0\pt 0.0\pt
"d3" "\deighthflag" 0.0\pt 5.0\pt 0.0\pt 0.0\pt