From 47d57fc7c6db37f356f7d0a4413e36fd9d25718a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 23 Aug 1999 01:43:06 +0200 Subject: [PATCH] release: 1.2.2 --- ChangeLog => CHANGES | 23 +- ChangeLog.orig | 26 - Documentation/BLURB.in | 1 - Documentation/FLAPTEKST.in | 10 +- Documentation/bibliography/engraving.bib | 21 +- Documentation/tex/lilypond-regtest.doc | 12 +- Documentation/tex/mudela-book-doc.doc | 54 +- Documentation/topdocs/index.yo | 10 +- TODO | 17 +- VERSION | 4 +- buildscripts/mf-to-table.py | 189 ++- buildscripts/ps-to-gifs.sh | 1 - buildscripts/ps-to-pfa.py | 4 - debian/control | 1 - debian/out/control | 1 - flower/getopt-long.cc | 108 +- flower/include/getopt-long.hh | 13 +- flower/include/international.hh | 7 + lily/main.cc | 152 +-- make/mudela-rules.make | 6 +- make/out/lilypond.lsm | 9 +- make/out/lilypond.spec | 5 +- make/toplevel.make.in | 2 +- mf/feta-autometric.mf | 8 +- midi2ly/main.cc | 351 +++-- midi2ly/version.cc | 4 +- po/GNUmakefile | 1 + po/it.po | 335 +++-- po/lilypond.po | 205 +-- po/nl.po | 296 ++--- scripts/convert-mudela.py | 331 +++-- scripts/ly2dvi.py | 4 + scripts/mudela-book.py | 1480 ++++++++++------------ stepmake/bin/make-version.py | 27 + stepmake/bin/make-version.sh | 13 - stepmake/stepmake/generic-targets.make | 2 +- stepmake/stepmake/po-targets.make | 2 +- 37 files changed, 1852 insertions(+), 1883 deletions(-) rename ChangeLog => CHANGES (62%) delete mode 100644 ChangeLog.orig create mode 100644 stepmake/bin/make-version.py delete mode 100755 stepmake/bin/make-version.sh diff --git a/ChangeLog b/CHANGES similarity index 62% rename from ChangeLog rename to CHANGES index d867e35077..03566b51e0 100644 --- a/ChangeLog +++ b/CHANGES @@ -1,6 +1,25 @@ +pl 1.uu2 + - complete rewrite of mudela-book. Much cleaner now. +Support for texinfo. + - convert-mudela now per file, add \version if not present. + +pl 1.uu1.jcn1 + - internationalization fixes for getopt-long help + +pl 1.uu1 + - rewrite --help messages for help2man: + * lilypond + * mi2mu + * mudela-book + * convert-mudela + - cleanup: mf-to-table.py + - Getopt_long: support for --help msg. + pl 1.mb1 - - bf, scalar.cc: ".3" now detected as numerical - + - bf, scalar.cc: ".3" now detected as numerical + +******** + pl 0.uu1 - refman updates by Werner & Mats - now use ChangeLog for changes. diff --git a/ChangeLog.orig b/ChangeLog.orig deleted file mode 100644 index 9fb50003f5..0000000000 --- a/ChangeLog.orig +++ /dev/null @@ -1,26 +0,0 @@ -pl 0.uu1 - - refman updates by Werner & Mats - - now use ChangeLog for changes. - -pl 0.jcn2 - - po fixes - -pl 0.jcn1 - - gcc-2.95 nitpicks - - added pointers to mailing lists in toplevel docs - -0.mb2 - - configure: more robust detection of Guile - - Midi_note_off: revert to fixed note-off velocity. Fixes - problem with notes that never stop. - - Decreased breakable_column_space_strength - - Added a few TODO - - bf: "harmonic" and "cross" note heads also for half and - whole notes. - - linewidth and textheight set independent of the font size. - - bf, titledefs.tex: opus and piece are not repeated for - every piece unless they are explicitly set again. - -0.mb1 - - Changed dynamicDir to dynamicDirection. - - refman and tutorial corrections. diff --git a/Documentation/BLURB.in b/Documentation/BLURB.in index 591817db35..6933b58e2e 100644 --- a/Documentation/BLURB.in +++ b/Documentation/BLURB.in @@ -2,4 +2,3 @@ LilyPond is a music typesetter. It produces beautiful sheet music using a high level description file as input. LilyPond is part of the GNU Project. - diff --git a/Documentation/FLAPTEKST.in b/Documentation/FLAPTEKST.in index cedaa2e995..b09dbad7b3 100644 --- a/Documentation/FLAPTEKST.in +++ b/Documentation/FLAPTEKST.in @@ -1,7 +1,3 @@ -LilyPond is de muziekzetter van het GNU Project. Dit programma drukt -prachtige bladmuziek volgens een muzikaal definitie bestand. Ook kan -het een mechanische uitvoering afspelen naar een MIDI bestand. -Bijzondere kunstjes zijn verscheidene notenbalken, maatsoorten, sleutels, -toonaarden, zangteksten, krachtige invoer taal, cadensa, balken, boogjes, -triolen, accoordnamen, transponeren, partituren, en uittreksels voor -individuele partijen. Een fraaie set muziektekens is inbegrepen. +LilyPond is een muziekzetter. Zij maakt prachtige bladmuziek +uitgaande van een hoog niveau beschrijving bestand. LilyPond +maakt deel uit van het GNU Project. diff --git a/Documentation/bibliography/engraving.bib b/Documentation/bibliography/engraving.bib index e423f0c1b0..2696988d1b 100644 --- a/Documentation/bibliography/engraving.bib +++ b/Documentation/bibliography/engraving.bib @@ -225,16 +225,6 @@ year={1989} } - -@Book{unknown69:_music_notat, - author = {--}, - title = {Music Notation}, - publisher = {Crescendo books}, - year = 1969, - note = {Heussenstamm writes: An extremely thorough exploration of musical notation [..]} -} - - @Book {gerou96, note = {A concise, alphabetically ordered list of typesetting and music (notation) issues with a rather simplistic attitude but in most cases "good-enough" answers JCN}, year = {1996}, @@ -274,7 +264,7 @@ year={1989} title = {Handbuch der Notationskunde}, address={Leipzig}, publisher={Breitkopf & Hartel}, - note= {Very thorough treatment (in two volumes) of the history musical notation}, + note= {Very thorough treatment (in two volumes) of the history of music notation}, } @Book {rosenthal67, @@ -313,3 +303,12 @@ year={1989} +@Book{tyboni94:_noter_handb_i_tradit_noter, + author = {B\"oje Tyboni}, + title = {Noter Handbok I Traditionell Notering}, + publisher = {Gehrmans Musikf\"orlag}, + year = 1994, + address = {Stockholm}, + note = {Swedish book on music notation.} +} + diff --git a/Documentation/tex/lilypond-regtest.doc b/Documentation/tex/lilypond-regtest.doc index 3154acf42b..79ad4b8331 100644 --- a/Documentation/tex/lilypond-regtest.doc +++ b/Documentation/tex/lilypond-regtest.doc @@ -258,17 +258,17 @@ Fonts are available in a default set of sizes: 11, 13, 16, 20, 23 and 26pt staffheight. Sizes of the text fonts and symbol fonts are made to match the staff dimensions. -\mudelafile{size11.ly} +\mudelafile[nofly]{size11.ly} -\mudelafile{size13.ly} +\mudelafile[nofly]{size13.ly} -\mudelafile{size16.ly} +\mudelafile[nofly]{size16.ly} -\mudelafile{size20.ly} +\mudelafile[nofly]{size20.ly} -\mudelafile{size23.ly} +\mudelafile[nofly]{size23.ly} -\mudelafile{size26.ly} +\mudelafile[nofly]{size26.ly} \section{Clefs and Time Signatures} diff --git a/Documentation/tex/mudela-book-doc.doc b/Documentation/tex/mudela-book-doc.doc index 95a439f6d7..97fd452457 100644 --- a/Documentation/tex/mudela-book-doc.doc +++ b/Documentation/tex/mudela-book-doc.doc @@ -32,7 +32,7 @@ This document assumes you have basic knowledge of GNU LilyPond and send a patch. So what does this look like? Well, here is an example: -\begin{mudela}[veryverbatim, intertext="produces this music:"] +\begin[veryverbatim, intertext="produces this music:"]{mudela} \score{ \notes\relative c'{ \time 5/8; @@ -67,7 +67,7 @@ music, another file than \verb|paper16.ly| will be included. If you want to make the music not so wide, you can insert a \verb|\paper| statement that set the linewidth: -\begin{mudela}[veryverbatim, intertext="produces this music:"] +\begin[veryverbatim, intertext="produces this music:"]{mudela} \score{ \notes\relative c'{ \time 5/8; @@ -88,12 +88,12 @@ If you only write voice-contents in the mudela block, mudela-book will set the \verb|linewidth| variable to -1, so Lilypond will make the music as short as possible but without breaking the line. Here is a well know harmonic progression: -\begin{mudela}[veryverbatim, intertext="produce a well known harmonic progression:"] +\begin[veryverbatim, intertext="produce a well known harmonic progression:"]{mudela} \end{mudela} If you want to place music examples in the text, -\begin{mudela}[eps] +\begin[eps]{mudela} \end{mudela} , you can use the \verb|eps| option. This will create the music as @@ -102,14 +102,14 @@ eps graphics and include it into the document with the The code used look like this: \begin{verbatim} -\begin{mudela}[eps] +\begin[eps]{mudela} \end{mudela} \end{verbatim} You can also use the \verb|eps| option if the block is a complete mudela source. This 5 cm long empty line, -\begin{mudela}[eps] +\begin[eps]{mudela} \score{ \notes{s} \paper{ linewidth = 5.\cm;} @@ -117,7 +117,7 @@ mudela source. This 5 cm long empty line, \end{mudela} was created with this code: \begin{verbatim} -\begin{mudela}[eps] +\begin[eps]{mudela} \score{ \notes{s} \paper{ linewidth = 5.\cm;} @@ -140,7 +140,7 @@ You can use all lilypond fontsizes in mudela-book. The default 16pt fontsize, \mudela{}, is probably to big to be included in the middle of the text. 11pt, \mudela[11pt]{} or 13pt, \mudela[13pt]{} is probably better. The code can look like this: \begin{verbatim} -\begin{mudela}[13pt, eps] +\begin[13pt, eps]{mudela} \end{mudela} \end{verbatim} @@ -148,35 +148,35 @@ The code can look like this: The following options set the fontsize: \begin{itemize} \item \verb|11pt| -\begin{mudela}[11pt, eps] +\begin[11pt, eps]{mudela} \relative c'{ r16 [c d e][f d e c] [g'8 c][b-\prall c] | [d16 g, a b][c a b g][d'8 g f-\prall g] } \end{mudela} \item \verb|13pt| -\begin{mudela}[13pt, eps] +\begin[13pt, eps]{mudela} \relative c'{ r16 [c d e][f d e c] [g'8 c][b-\prall c] | [d16 g, a b][c a b g][d'8 g f-\prall g] } \end{mudela} \item \verb|16pt| -\begin{mudela}[16pt, eps] +\begin[16pt, eps]{mudela} \relative c'{ r16 [c d e][f d e c] [g'8 c][b-\prall c] | [d16 g, a b][c a b g][d'8 g f-\prall g] } \end{mudela} \item \verb|20pt| -\begin{mudela}[20pt, eps] +\begin[20pt, eps]{mudela} \relative c'{ r16 [c d e][f d e c] [g'8 c][b-\prall c] | [d16 g, a b][c a b g][d'8 g f-\prall g] } \end{mudela} \item \verb|26pt| -\begin{mudela}[26pt, eps] +\begin[26pt, eps]{mudela} \relative c'{ r16 [c d e][f d e c] [g'8 c][b-\prall c] | [d16 g, a b][c a b g][d'8 g f-\prall g] @@ -196,12 +196,12 @@ file is a definition of a python dictionary: \begin{verbatim} { 'mudela': r""" -\begin{mudela}[eps \fontoptions] +\begin[eps \fontoptions]{mudela} \maininput \end{mudela} """, 'mudelaRhythm': r""" -\begin{mudela}[eps \fontoptions] +\begin[eps \fontoptions]{mudela} \score{ \context RhythmicStaff{ \notes{\stemup \maininput} @@ -216,7 +216,7 @@ The above code show how \verb|\mudela| could have been defined, and also defines a new command \verb|mudelaRhythm|. Notice that you can send fontsize options to the defined commands. \verb|\mudelaRhythm[11pt]{c4 c8 [c16 c] c4 c}| produce this music: -\begin{mudela}[eps, 11pt] +\begin[eps, 11pt]{mudela} \score{ \context RhythmicStaff{ \notes{ \stemup c4 r8 [c16 c] c4 c } @@ -244,18 +244,18 @@ need to wait for the price money to grow. So send a bug report today if you need this one of these options. \section{Examples} -This was all options to \verb|\begin{mudela}|. The rest of the +This was all options to \verb|\begin|. The rest of the{mudela} document will show some ways you can use mudela in \LaTeX~documents. It will also act as a simple test-suite for mudela-book. You \marginpar{ marginpar! -\begin{mudela}[eps, 11pt] +\begin[eps, 11pt]{mudela} \relative c'' {\key c \minor; r4 [g8 g g] es2} \end{mudela} }can place \verb|eps| mudela in footnotes\footnote{ footnote! -\begin{mudela}[eps, 11pt] +\begin[eps, 11pt]{mudela} \relative c'' {\key c \minor;r4 [g8 g g] es2} \end{mudela} } @@ -284,7 +284,7 @@ the right marging if you set floatingfigure width and mudela linewidth to the same value. The code looks like this: \verb|\begin{floatingfigure}{7cm}| -\begin{mudela}[verbatim] +\begin[verbatim]{mudela} \score{ \notes\relative c'{ \time 12/8; @@ -310,22 +310,22 @@ names of some triads: \hline dur & -\begin{mudela}[eps, fragment] +\begin[eps, fragment]{mudela} -\end{mudela} +\end{mudela} \\ \hline moll & -\begin{mudela}[eps] +\begin[eps]{mudela} \end{mudela} \\ \hline forminsket & -\begin{mudela}[eps] +\begin[eps]{mudela} \end{mudela} \\ \hline forstørret & -\begin{mudela}[eps] +\begin[eps]{mudela} \end{mudela} \\ @@ -347,11 +347,11 @@ line. The following code will probably break: \begin{verbatim} \footnote{\begin{mudela} \relative c''{ \key es; r8 [g g g] es2} -\end{mudela}} +\end}{mudela} \end{verbatim} Mudela-book does know about \verb|\onecolumn| and \verb|\twocolumn|. So the music will be adjusted to the new linewith: -\begin{mudela}[veryverbatim, intertext="produces"] +\begin[veryverbatim, intertext="produces"]{mudela} \score{ \notes\relative c'{c d e f | g2 g | a4 a a a | g1 | f4 f f f | e2 e | d4 d d d | c1} diff --git a/Documentation/topdocs/index.yo b/Documentation/topdocs/index.yo index 61621f2a66..bf794f498e 100644 --- a/Documentation/topdocs/index.yo +++ b/Documentation/topdocs/index.yo @@ -18,10 +18,6 @@ center(mudela(fragment)( \relative c'' { \key es; r8 [c16 b] [c8 g] [as c16 b] [c8 d] | g,4 } )) - - - - nsect(Free Software) Of course LilyPond, being part of the GNU project, is url(free @@ -29,6 +25,12 @@ software)(http://www.fsf.org/copyleft/copyleft.html). For more url(information)(http://www.fsf.org/philosophy/philosophy.html), see the url(Free Software Foundation)(http://www.fsf.org/). +LilyPond comes in two variants, a stable one, and a development +snapshots. The webpages matching the stable versions are at +lurl(http://www.gnu.org/software/...), the development pages are at +lurl(http://www.cs.uu.nl/~hanwen/lilypond/). + + nsect(Preview) itemize( diff --git a/TODO b/TODO index 673acaf3eb..594ae3ad4a 100644 --- a/TODO +++ b/TODO @@ -8,8 +8,9 @@ m Most of the items are marked in the code as well Grep -i for TODO, FIXME and ugh/ugr/urg. -.* TODO after 1.2 +.* TODO . * Break_req handling is silly (break_forbid () + \break fucks up.) +. * redo all --help messages. . * HaraKiriStaffContext removes bar lines and doesn't remove staff margin text on removed staff lines. . * make all Feta (including dynamics) available to the user in @@ -24,7 +25,19 @@ abc2ly, midi2ly? . * Junk ghost positioning objects eg, Script leans on Staffside leans on Staff. . * bracket ps code. -. * mudela-book. +. * mudela-book +. * center option (??) +. * make mudela-book understand usepackage{geometry} +. * check that linewidth set in \paper is not wider than actual linewidth? +. * the following fails because mudelabook doesn't care that the + last } after \end{mudela} finishes the marginpar: + \marginpar{ + \begin{mudela} + c d e f g + \end{mudela}} +. * force-verbatim is maybe not that useful since latex fails with footnotes, + marginpars and others +""" . * Key_engraver, Local_key_item . * Think of comprehensive solution for "if (grace_b == self_grace_b_)" . * String[String.length] doesn't trap. diff --git a/VERSION b/VERSION index f0e4122f18..95a1009af5 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=2 -PATCH_LEVEL=1 -MY_PATCH_LEVEL=mb1 +PATCH_LEVEL=2 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py index 7b6ecd183e..efbcb7e661 100644 --- a/buildscripts/mf-to-table.py +++ b/buildscripts/mf-to-table.py @@ -6,20 +6,13 @@ # # (c) 1997 Han-Wen Nienhuys - -# -# TODO: Should use RE. -# - import os import sys import getopt -from string import * -import regex -import regsub +import string +import re import time - (options, files) = getopt.getopt( sys.argv[1:], 'a:d:hl:o:p:t:', ['afm=', 'outdir=', 'dep=', 'tex=', 'debug', 'help', 'package=']) @@ -30,92 +23,49 @@ for opt in options: if o == '-p' or o == '--package': topdir = a -sys.path.append (topdir + '/stepmake/bin') -from packagepython import * -package = Package (topdir) -packager = Packager () - -from packagepython import * -from flower import * +def gulp_file(f): + try: + i = open(f) + i.seek (0, 2) + n = i.tell () + i.seek (0,0) + except: + print 'can\'t open file: ' + f + '\n' + return '' + s = i.read (n) + if len (s) <= 0: + print 'gulped empty file: ' + f + '\n' + i.close () + return s + +version = '0.9' -begin_autometric_re = regex.compile('@{') -end_autometric_re = regex.compile('@}') -include_re = regex.compile ('(\([a-zA-Z_0-9-]+\.mf\)') -autometric_re = regex.compile('@{\(.*\)@}') -version = '0.8' postfixes = ['log', 'dvi', '2602gf', 'tfm'] -class Feta_file(File): - """Read Feta metrics from a metafont log-file.""" - - def include_scan (self, line): - include_pos = include_re.search (line) - while include_pos <> -1: - self.dependencies.append (include_re.group (1)) - - line = line[include_pos + 1:] - include_pos = include_re.search (line) - - def read_autometricline(self): - line = '' - while end_autometric_re.search(line) == -1 and not self.eof(): - suf = File.readline(self) - self.include_scan (suf) - if begin_autometric_re.search(line) == -1: - line = '' - line = line + regsub.sub('\n','', suf) - line = regsub.sub('\r','', line) - - if self.eof(): - return '' - - return line; - def readline(self): - """return what is enclosed in one @{ @} pair""" - line = ''; - 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) - self.dependencies = [] - def do_file(infile_nm): - infile = readline(); - -# -# FIXME: should parse output for {} to do indenting. -# -class Indentable_file(File): - """Output file with support for indentation""" - def __init__(self,nm, mode): - File.__init__(self,nm,mode) - self.current_indent_ = 0 - self.delta_indent_ = 4 - def writeline (self, str): - File.write(self, str) - def writeeol(self): - File.write(self, '\n') - File.write(self, ' '* self.current_indent_) - - def indent(self): - self.current_indent_ = self.delta_indent_ + self.current_indent_; - def dedent(self): - self.current_indent_ = self.current_indent_ - self.delta_indent_; - if self.current_indent_ < 0: - raise 'Nesting!' - - def write(self, str): - lines = split(str, '\n') - for l in lines[:-1]: - self.writeline(l) - self.writeeol() - self.writeline (lines[-1]) - -class Afm_file (File): +print re + +def read_log_file (fn): + str = gulp_file (fn) + str = re.sub ('\n', '', str) + str = re.sub ('[\t ]+', ' ', str) + + deps = [] + autolines = [] + def include_func (match, d = deps): + d.append (match.group (1)) + return '' + + def auto_func (match, a = autolines): + a.append (match.group (1)) + return '' + + str = re.sub ('\(([a-zA-Z_0-9-]+\.mf)', include_func, str) + str = re.sub ('@{(.*?)@}', auto_func, str) + + return (autolines, deps) + + +class Afm_file: def print_dimen(self, f): f = f * 1000 / self.fontsize @@ -127,8 +77,8 @@ class Afm_file (File): self.write( dimstr +' '); def def_symbol (self, code, lily_id, tex_id, xdim, ydim): - xdim = map (atof, xdim) - ydim = map (atof, ydim) + xdim = map (string.atof, xdim) + ydim = map (string.atof, ydim) wid = xdim[0] + xdim[1] self.write ('C %s ; ' % code) @@ -143,30 +93,36 @@ class Afm_file (File): self.print_dimen(ydim [1]) self.write (' ;\n'); - + def write (self, str): + self.file.write (str) + def __init__ (self, fn): + self.file = open (fn,'w') def start (self,nm): self.write ('Start%s\n' % nm) def end (self,nm): self.write ('End%s\n' % nm) + 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 = string.split(line, '@:') label = tags[0] name = tags[1] afm = self.afmfile + print tags if tags[0] == 'font': self.texfile.write("% name\n") afm.write ('FontName %s\n' % name) afm.start ('FontMetrics') afm.start ('CharMetrics') - afm.fontsize = atof(tags[2]) + afm.fontsize = string.atof(tags[2]) elif label == "group": self.texfile.write("% " + name + "\n") afm.groupname = name @@ -203,18 +159,17 @@ class Log_reader: def do_file(self,filenm): self.texfile.write ('\n% input from ' + filenm + '\n') - feta = Feta_file(filenm) - while not feta.eof(): - line = feta.readline() - self.output_label(line) - feta.close() + (autolines, deps) = read_log_file (filenm) + + for a in autolines: + self.output_label(a) - self.writedeps (feta.dependencies) + self.writedeps (deps) def __init__(self, texfile_nm, depfile_nm, afmfile_nm): - self.texfile = Indentable_file(texfile_nm, 'w') - self.depfile = File (depfile_nm, 'w') - self.afmfile = Afm_file (afmfile_nm, 'w') + self.texfile = open(texfile_nm, 'w') + self.depfile = open (depfile_nm, 'w') + self.afmfile = Afm_file (afmfile_nm) headerstr = '%% Creator: %s\n%% Automatically generated on\n%% Do not edit' % \ (program_id() ) @@ -238,17 +193,17 @@ def identify(): sys.stdout.write(program_id() + '\n') def help(): - sys.stdout.write("Usage: mf-to-table [options] LOGFILEs\n" - + "Generate mozarella metrics table from preparated feta log\n\n" - + "Options:\n" - + " -a, --afm=FILE .afm file\n" - + " -d, --dep=FILE print dependency info to FILE\n" - + " -h, --help print this help\n" - + " -l, --ly=FILE name output table\n" - + " -o, --outdir=DIR prefix for dependency info\n" - + " -p, --package=DIR specify package\n" - + " -t, --tex=FILE name output tex chardefs\n" - ) + sys.stdout.write(r"""Usage: mf-to-table [options] LOGFILEs +Generate feta metrics table from preparated feta log\n +Options: + -a, --afm=FILE .afm file + -d, --dep=FILE print dependency info to FILE + -h, --help print this help + -l, --ly=FILE name output table + -o, --outdir=DIR prefix for dependency info + -p, --package=DIR specify package + -t, --tex=FILE name output tex chardefs""" +) sys.exit (0) diff --git a/buildscripts/ps-to-gifs.sh b/buildscripts/ps-to-gifs.sh index bf9c8c8c75..e2a3da89cb 100755 --- a/buildscripts/ps-to-gifs.sh +++ b/buildscripts/ps-to-gifs.sh @@ -74,7 +74,6 @@ fi # urg, pipe breaks rm -f $BASE{.ppm,.$GIF} $BASE-page*{.ppm,.$GIF} -# generate the pixmap at twice the size, then rescale (for antialiasing) cat $FILE | gs -sDEVICE=pgm $SIZE -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile="$BASE-page%d.ppm" -r90 -dNOPAUSE - -c quit $FILE # quant is soo slow # cat $PPMFILE | ppmquant 2 | pnmscale 0.3333 | pnmcrop | $PNMTOGIF $color > $OUTFILE diff --git a/buildscripts/ps-to-pfa.py b/buildscripts/ps-to-pfa.py index f1d4d8c38b..bab745820d 100644 --- a/buildscripts/ps-to-pfa.py +++ b/buildscripts/ps-to-pfa.py @@ -16,12 +16,8 @@ datadir = '' import find import os import sys - import getopt from string import * -import regsub - -# todo, port: see http://starship.skyport.net/crew/amk/regex/regex-to-re.html import re import time diff --git a/debian/control b/debian/control index 183e068afc..5b0c3d387b 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,6 @@ Description: The GNU Project music typesetter. using a high level description file as input. LilyPond is part of the GNU Project. - . URLs: http://www.cs.uu.nl/~hanwen/lilypond/ http://www.xs4all.nl/~jantien/lilypond/ diff --git a/debian/out/control b/debian/out/control index 183e068afc..5b0c3d387b 100644 --- a/debian/out/control +++ b/debian/out/control @@ -14,7 +14,6 @@ Description: The GNU Project music typesetter. using a high level description file as input. LilyPond is part of the GNU Project. - . URLs: http://www.cs.uu.nl/~hanwen/lilypond/ http://www.xs4all.nl/~jantien/lilypond/ diff --git a/flower/getopt-long.cc b/flower/getopt-long.cc index e3a3176b27..c63f04e353 100644 --- a/flower/getopt-long.cc +++ b/flower/getopt-long.cc @@ -7,8 +7,20 @@ #include #include #include +#include "config.hh" #include "getopt-long.hh" #include "international.hh" +#include "string-convert.hh" + +#if !HAVE_GETTEXT +inline char* +gettext (char const* s) +{ + return s; +} +#else +#include +#endif long Getopt_long::argument_to_i() @@ -33,7 +45,7 @@ Getopt_long::parselong() found_option_l_=0; for (int i=0; i< table_len_i_; i++) { - char const *ln = option_a_[i].longname; + char const *ln = option_a_[i].longname_sz_; if (ln && !strncmp (ln, optnm, searchlen)) { @@ -51,7 +63,7 @@ Getopt_long::parselong() argument_index_i_ = 0; - if (found_option_l_->take_arg) + if (found_option_l_->take_arg_sz_) { if (endopt) optional_argument_ch_C_ = endopt +1; // a '=' @@ -78,15 +90,41 @@ String Long_option_init::str () const { String str; - if (shortname) - str += "-" + shortname; - if (shortname && longname) + if (shortname_ch_) + str += "-" + shortname_ch_; + if (shortname_ch_ && longname_sz_) str += ", "; - if (longname) - str += String ("`--") + longname + "'"; + if (longname_sz_) + str += String ("`--") + longname_sz_ + "'"; return str; } +String +Long_option_init::str_for_help () const +{ + String s; + if (shortname_ch_) + s = "-" + to_str (shortname_ch_); + else + s = " "; + + s = s + ((shortname_ch_ && longname_sz_) ? "," : " "); + + if (longname_sz_) + s = s + "--" + longname_sz_; + + if (take_arg_sz_) + { + if (longname_sz_) + s = s + "="; + else + s = s + " "; + + s = s + gettext (take_arg_sz_); + } + return s; +} + // report an error, GNU style. void Getopt_long::report (Errorcod c) @@ -131,7 +169,7 @@ Getopt_long::parseshort() assert (c); for (int i=0; i < table_len_i_; i++) - if (option_a_[i].shortname == c) + if (option_a_[i].shortname_ch_ == c) { found_option_l_ = option_a_+i; break; @@ -144,7 +182,7 @@ Getopt_long::parseshort() } argument_index_i_++; - if (!found_option_l_->take_arg) + if (!found_option_l_->take_arg_sz_) { optional_argument_ch_C_ = 0; return found_option_l_; @@ -205,6 +243,8 @@ Getopt_long::operator()() } } + + Getopt_long::Getopt_long (int c, char **v, Long_option_init *lo) { option_a_ = lo; @@ -216,8 +256,9 @@ Getopt_long::Getopt_long (int c, char **v, Long_option_init *lo) // reached end of option table? table_len_i_ =0; - for (int i = 0; option_a_[i].longname ||option_a_[i].shortname; i++) + for (int i = 0; option_a_[i].longname_sz_ ||option_a_[i].shortname_ch_; i++) table_len_i_ ++; + } bool @@ -258,3 +299,50 @@ Getopt_long::get_next_arg() } return a; } + + +const int EXTRA_SPACES = 5; + +String +Long_option_init::table_str (Long_option_init *l) +{ + String argstr = "ARG"; + String tabstr = ""; + + int wid = 0; + for (int i=0; l[i].shortname_ch_ || l[i].longname_sz_; i++) + { + wid = wid >? l[i].str_for_help ().length_i (); + } + + for (int i=0; l[i].shortname_ch_ || l[i].longname_sz_; i++) + { + String s = " " + l[i].str_for_help (); + s += String_convert::char_str (' ', wid - s.length_i () + EXTRA_SPACES); + + tabstr += s + gettext (l[i].help_sz_) + "\n"; + } + + + return tabstr; +} + +int +Long_option_init::compare (Long_option_init const &a, Long_option_init const &b) +{ + if (a.shortname_ch_ && b.shortname_ch_ && a.shortname_ch_- b.shortname_ch_) + return a.shortname_ch_ - b.shortname_ch_; + + if (b.shortname_ch_ && a.longname_sz_) + { + char s[2] = {b.shortname_ch_, 0}; + return strcmp (a.longname_sz_, s); + } + if (a.shortname_ch_ && b.longname_sz_) + { + char s[2] = {a.shortname_ch_, 0}; + return strcmp (s, b.longname_sz_); + } + + return strcmp (a.longname_sz_, b.longname_sz_); +} diff --git a/flower/include/getopt-long.hh b/flower/include/getopt-long.hh index a069e28422..92de4934dc 100644 --- a/flower/include/getopt-long.hh +++ b/flower/include/getopt-long.hh @@ -9,11 +9,18 @@ class ostream; a struct this for initialising the commandline options. */ struct Long_option_init { - bool take_arg; - char const * longname; - char shortname; + char const * take_arg_sz_; + char const * longname_sz_; + char shortname_ch_; + char const * help_sz_; + String str () const; + String str_for_help () const; + // NO constructor! + + static int compare (Long_option_init const&,Long_option_init const&); + static String table_str (Long_option_init *); }; diff --git a/flower/include/international.hh b/flower/include/international.hh index 49a414a394..5ebbb65aee 100644 --- a/flower/include/international.hh +++ b/flower/include/international.hh @@ -12,6 +12,13 @@ #include "string.hh" +/** + Internationalisation: _i ("to be translated") gets an entry in the POT file + gettext () must be invoked explicitely to do the actual "translation". + See flower/getopt-long.cc. + */ +#define _i(sz) sz + // don't inline: get warnings only once /** Internationalisation: _ ("to be translated") gets "translated" by GNU gettext diff --git a/lily/main.cc b/lily/main.cc index e48887a977..bb3fb5d973 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -59,83 +59,47 @@ Getopt_long * oparser_global_p = 0; String distill_inname_str (String name_str, String& ext_r); +/* + Internationalisation kludge in two steps: + * use _i () to get entry in POT file + * call gettext () explicitely for actual "translation" + */ Long_option_init theopts[] = { - {0, "about", 'a'}, - {1, "output", 'o'}, - {0, "warranty", 'w'}, - {0, "help", 'h'}, - {0, "test", 't'}, - {0, "debug", 'd'}, - {1, "init", 'i'}, - {1, "include", 'I'}, - {0, "no-paper", 'm'}, - {0, "dependencies", 'M'}, // like GCC - {0, "no-timestamps", 'T'}, // why do we have this option? - {0, "find-old-relative", 'Q'}, - {0, "ignore-version", 'V'}, - {0, "version", 'v'}, - {1, "output-format", 'f'}, - {0, "safe", 's'}, - {0,0,0} + {_i ("BASENAME"), "output", 'o', _i ("write output to BASENAME[-x].extension")}, + {0, "warranty", 'w', _i ("show warranty and copyright")}, + {0, "help", 'h', _i ("this help")}, + {0, "test", 't', _i ("switch on experimental features")}, + {0, "debug", 'd', _i ("enable debugging output")}, + {_i ("FILE"), "init", 'i', _i ("use FILE as init file")}, + {_i ("DIR"), "include", 'I', _i ("add DIR to search path")}, + {0, "no-paper", 'm', _i ("produce midi output only")}, + {0, "dependencies", 'M', _i ("write Makefile dependencies for every input file")}, + {0, "no-timestamps", 'T', _i ("don't timestamp the output")}, + {0, "find-old-relative", 'Q', _i ("show all changes in relative syntax")}, + {0, "ignore-version", 'V', _i ("ignore mudela version")}, + {0, "version", 'v', _i ("print version number")}, + {_i ("EXT"), "output-format", 'f', _i ("use output format EXT")}, + {0, "safe", 's', _i ("inhibit file output naming and exporting")}, + {0,0,0, 0} }; void usage () { - cout << _f ("Usage: %s [OPTION]... [FILE]...", "lilypond") << '\n'; - cout << _ ("Typeset music and or play MIDI from FILE or "); - cout << '\n'; + cout << _f ("Usage: %s [OPTION]... [FILE]...", "lilypond"); + cout << "\n\n"; + cout << _ ("Typeset music and or play MIDI from FILE."); + cout << "\n\n"; + cout << +#include "BLURB.hh" + cout << '\n'; cout << _ ("Options:"); cout << '\n'; - cout << _ ( - " -a, --about about LilyPond\n" - ); - cout << _ ( - " -d, --debug enable debugging output\n" - ); - cout << _ ( - " -M, --dependencies write Makefile dependencies for every input file\n" - ); - cout << _ ( - " -h, --help this help\n" - ); - cout << _ ( - " -f, --output-format=X use output format X\n" - ); - cout << _ ( - " -I, --include=DIR add DIR to search path\n" - ); - cout << _ ( - " -i, --init=FILE use FILE as init file\n" - ); - cout << _ ( - " -m, --no-paper produce midi output only\n" - ); - cout << _ ( - " -o, --output=FILE set FILE as default output base\n" - ); - cout << _ ( - " -Q, --find-old-relative show all changes in relative syntax\n" - ); - cout << _ ( - " -s, --safe inhibit file output naming and exporting TeX macros\n"); - cout << _ ( - " -t, --test switch on experimental features\n" - ); - cout << _ ( - " -T, --no-timestamps don't timestamp the output\n" - ); - cout << _ ( - " -V, --ignore-version ignore mudela version\n" - ); - cout << _ ( - " -w, --warranty show warranty and copyright\n" - ); - cout << '\n'; - cout << _ ("GNU LilyPond was compiled with the following settings:"); + cout << Long_option_init::table_str (theopts); cout << '\n'; - cout << + cout << _ ("This binary was compiled with the following options:") + << " " << #ifdef NDEBUG "NDEBUG " #endif @@ -145,44 +109,51 @@ usage () #ifdef STRING_UTILS_INLINED "STRING_UTILS_INLINED " #endif - "datadir=" DIR_DATADIR + "datadir =" DIR_DATADIR "\n" - "localedir=" DIR_LOCALEDIR + "localedir =" DIR_LOCALEDIR - "\n"; + "\n\n"; - ; + cout << _("Report bugs to") << " bug-gnu-music@gnu.org" << endl; print_mudela_versions (cout); } void -about () +identify () { + cout << gnu_lilypond_version_str () << endl; +} + +void +version () +{ + identify (); cout << '\n'; - cout << -#include "BLURB.hh" - cout << '\n'; - cout << _ ("GNU LilyPond is Free software, see --warranty"); - cout << '\n'; - cout << '\n'; + cout << _f ("" + "This is free software. It is covered by the GNU General Public License," + "and you are welcome to change it and/or distribute copies of it under" + "certain conditions. Invoke as `%s --warranty' for more information.\n", + "lilypond"); + cout << endl; + cout << _f ("Copyright (c) %s by", "1996--1999"); - cout << '\n'; - cout << " " + _ ("Han-Wen Nienhuys ") + "\n"; - cout << " " + _ ("Jan Nieuwenhuizen ") + "\n"; - cout << '\n'; + cout << "Han-Wen Nienhuys \n" + << "Jan Nieuwenhuizen \n"; } void notice () { cout << '\n'; + // GNU GNU? cout << _ ("GNU LilyPond -- The GNU Project music typesetter"); cout << '\n'; cout << _f ("Copyright (c) %s by", "1996--1999"); cout << '\n'; - cout << " " + _ ("Han-Wen Nienhuys ") + "\n"; - cout << " " + _ ("Jan Nieuwenhuizen ") + "\n"; + cout << " Han-Wen Nienhuys \n"; + cout << " Jan Nieuwenhuizen \n"; cout << '\n'; cout << _ ( " This program is free software; you can redistribute it and/or\n" @@ -200,11 +171,6 @@ notice () "USA.\n"); } -void -identify () -{ - *mlog << gnu_lilypond_version_str () << endl; -} void setup_paths () @@ -319,16 +285,16 @@ main_prog (int, char**) int main (int argc, char **argv) { - identify (); debug_init (); // should be first setup_paths (); oparser_global_p = new Getopt_long(argc, argv,theopts); while (Long_option_init const * opt = (*oparser_global_p)()) { - switch (opt->shortname) + switch (opt->shortname_ch_) { case 'v': + version(); exit (0); // we print a version anyway. break; case 't': @@ -354,9 +320,6 @@ main (int argc, char **argv) case 'i': init_str_global = oparser_global_p->optional_argument_ch_C_; break; - case 'a': - about (); - exit (0); case 'h': usage (); exit (0); @@ -384,6 +347,7 @@ main (int argc, char **argv) break; } } + identify (); #ifdef WINNT gh_enter (argc, argv, main_prog); diff --git a/make/mudela-rules.make b/make/mudela-rules.make index 478f2da9fb..4e82175ea2 100644 --- a/make/mudela-rules.make +++ b/make/mudela-rules.make @@ -5,5 +5,7 @@ $(outdir)/%.latex: %.doc - $(PYTHON) $(depth)/scripts/mudela-book.py -I $(depth)/input/test/ --outdir=$(outdir)/ --dependencies --outname=$(notdir $(basename $@)) $< - + cd $(outdir); $(PYTHON) $(depth)/../scripts/mudela-book.py -I .. -I $(depth)/../input/test/ --dependencies ../$< + sed 's! \.\./! !g'< $(basename $@).dep > $(outdir)/temp.dep + sed 's!^\(.*\):!'$(outdir)'/\1:!g' < $(outdir)/temp.dep > $(basename $@).dep + rm $(outdir)/temp.dep diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index 9e6b7df97a..6cc17d00d5 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,20 +1,19 @@ Begin3 Title: LilyPond -Version: 1.2.1 -Entered-date: 16AUG99 +Version: 1.2.2 +Entered-date: 23AUG99 Description: LilyPond is a music typesetter. It produces beautiful sheet music using a high level description file as input. LilyPond is part of the GNU Project. - Keywords: music notation typesetting midi fonts engraving Author: hanwen@cs.uu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 1000k lilypond-1.2.1.tar.gz + 1000k lilypond-1.2.2.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.2.1.tar.gz + 1000k lilypond-1.2.2.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index f53dfcc6a7..fdc84eaa5f 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.2.1 +Version: 1.2.2 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.2.1.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.2.2.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys @@ -18,7 +18,6 @@ using a high level description file as input. LilyPond is part of the GNU Project. - %prep %setup %build diff --git a/make/toplevel.make.in b/make/toplevel.make.in index 288eeed2f6..c26bfe991e 100644 --- a/make/toplevel.make.in +++ b/make/toplevel.make.in @@ -15,7 +15,7 @@ SUBDIRS = scripts buildscripts flower lib lily mf midi2ly po debian \ SCRIPTS = configure aclocal.m4 README_FILES = BUGS DEDICATION ANNOUNCE-0.1 ANNOUNCE-1.0 ANNOUNCE-1.2 \ - COPYING NEWS-0.1 NEWS-1.0 NEWS-0.0 NEWS-1.1 NEWS TODO AIMS ChangeLog + COPYING NEWS-0.1 NEWS-1.0 NEWS-0.0 NEWS-1.1 NEWS TODO AIMS CHANGES README_TXT_FILES = README.txt AUTHORS.txt INSTALL.txt PATCHES.txt IN_FILES := $(wildcard *.in) EXTRA_DIST_FILES = dstreamrc mudela-mode.el vimrc VERSION $(README_FILES) $(SCRIPTS) $(IN_FILES) TASKS diff --git a/mf/feta-autometric.mf b/mf/feta-autometric.mf index 76a21ed49d..c536c3334b 100644 --- a/mf/feta-autometric.mf +++ b/mf/feta-autometric.mf @@ -1,7 +1,8 @@ % % autometric.mf -- administrative MF routines % -% source file of the Feta (Font-En-Tja) pretty-but-neat music font +% source file of the Feta (not an acronym for Font-En-Tja) +% pretty-but-neat music font % % (c) 1997, 1998 Han-Wen Nienhuys % Jan Nieuwenhuizen @@ -10,6 +11,11 @@ % to automate generation of lily tables and tex backend % The output should be parsed by the mf-to-table script +message "******************************************************"; +message "Using feta Autometric macros. "; +message "Do not worry about the @ signs in the output, they are not errors. "; +message "******************************************************"; + % font or database? def fet_beginfont(expr name,size) = font_identifier:=name&decimal size; diff --git a/midi2ly/main.cc b/midi2ly/main.cc index 1fc5c25f59..2cf9e95917 100644 --- a/midi2ly/main.cc +++ b/midi2ly/main.cc @@ -36,92 +36,87 @@ static File_path path; Verbose level_ver = NORMAL_ver; + void -usage() +identify() { - cout << _f ("Usage: %s [OPTION]... [FILE]", "midi2ly"); - cout << '\n'; - cout << _ ("Translate midi-file to mudela"); - cout << '\n'; - cout << '\n'; - cout << _ ("Options:"); - cout << '\n'; - cout << _ ( - " -b, --no-quantify write exact durations, e.g.: a4*385/384\n" - ); - cout << _ ( - " -D, --debug enable debugging output\n" - ); - cout << _ ( - " -h, --help this help\n" - ); - cout << _ ( - " -I, --include=DIR add DIR to search path\n" - ); - cout << _ ( - " -k, --key=ACC[:MINOR] set key: ACC +sharps/-flats; :1 minor\n" - ); - cout << _ ( - " -n, --no-silly assume no tuplets or double dots, smallest is 32\n" - ); - cout << _ ( - " -o, --output=FILE set FILE as default output\n" - ); - cout << _ ( - " -p, --no-tuplets assume no tuplets\n" - ); - cout << _ ( - " -q, --quiet be quiet\n" - ); - cout << _ ( - " -T, --no-timestamps don't timestamp the output\n" - ); - cout << _ ( - " -s, --smallest=N assume no shorter (reciprocal) durations than N\n" - ); - cout << _ ( - " -v, --verbose be verbose\n" - ); - cout << _ ( - " -w, --warranty show warranty and copyright\n" - ); - cout << _ ( - " -x, --no-double-dots assume no double dotted notes\n" - ); - ; +cout << midi2ly_version_str() << endl; + } void -identify() +version () { - LOGOUT(NORMAL_ver) << midi2ly_version_str() << endl; + identify (); + cout << '\n'; + cout << _f ("" + "This is free software. It is covered by the GNU General Public License," + "and you are welcome to change it and/or distribute copies of it under" + "certain conditions. Invoke as `%s --warranty' for more information.\n", + "midi2ly"); + cout << endl; + + cout << _f ("Copyright (c) %s by", "1996--1999"); + cout << "Han-Wen Nienhuys \n" + << "Jan Nieuwenhuizen \n"; } void notice() { - LOGOUT(NORMAL_ver) << '\n'; - LOGOUT(NORMAL_ver) << _ ("Midi2ly, translate midi to mudela"); - LOGOUT(NORMAL_ver) << '\n'; - LOGOUT(NORMAL_ver) << _f ("Copyright (c) %s by", "1997, 1998"); - LOGOUT(NORMAL_ver) << '\n'; - LOGOUT(NORMAL_ver) << " " + _ ("Han-Wen Nienhuys ") + "\n"; - LOGOUT(NORMAL_ver) << " " + _ ("Jan Nieuwenhuizen ") + "\n"; - LOGOUT(NORMAL_ver) << '\n'; - LOGOUT(NORMAL_ver) << _ ( - " This program is free software; you can redistribute it and/or\n" - "modify it under the terms of the GNU General Public License version 2\n" - "as published by the Free Software Foundation.\n" - "\n" - " This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" - "General Public License for more details.\n" - "\n" - " You should have received a copy (refer to the file COPYING) of the\n" - "GNU General Public License along with this program; if not, write to\n" - "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n" - "USA.\n"); + cout << _ ( + " This program is free software; you can redistribute it and/or\n" + "modify it under the terms of the GNU General Public License version 2\n" + "as published by the Free Software Foundation.\n" + "\n" + " This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" + "General Public License for more details.\n" + "\n" + " You should have received a copy (refer to the file COPYING) of the\n" + "GNU General Public License along with this program; if not, write to\n" + "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n" + "USA.\n"); +} + +/* + Internationalisation kludge in two steps: + * use _i () to get entry in POT file + * call gettext () explicitely for actual "translation" + */ +Long_option_init long_option_init_a[] = +{ + {0, "no-quantify", 'b', _i ("write exact durations, e.g.: a4*385/384")}, + {0, "debug", 'd', _i ("enable debugging output")}, + {0, "help", 'h', _i ("this help")}, + {_i ("ACC[:MINOR]"), "key", 'k', _i ("set key: ACC +sharps/-flats; :1 minor")}, + {0, "no-silly", 'n', _i ("assume no tuplets or double dots, smallest is 32")}, + {_i ("FILE"), "output", 'o', _i ("set FILE as default output")}, + {0, "no-tuplets", 'p', _i ("assume no tuplets")}, + {0, "quiet", 'q', _i ("be quiet")}, + {_i ("DUR"), "smallest", 's', _i ("Set smallest duration (?)")}, + {0, "no-timestamps", 'T', _i ("don't timestamp the output")}, + {0, "verbose", 'v', _i ("be verbose")}, + {0, "warranty", 'w', _i ("show warranty and copyright")}, + {0, "no-double-dots", 'x', _i ("assume no double dotted notes")}, + {0, "version", 'V', _i ("print version number")}, + {0,0,0, 0} +}; + +void +usage() +{ + cout << _f ("Usage: %s [OPTION]... [FILE]", "midi2ly"); + cout << '\n'; + cout << _ ("Translate midi-file to mudela"); + cout << '\n'; + cout << '\n'; + cout << _ ("Options:"); + cout << '\n'; + cout << Long_option_init::table_str (long_option_init_a) << endl; + + cout << _("Report bugs to") << " bug-gnu-music@gnu.org" << endl; } int @@ -140,98 +135,86 @@ main (int argc_i, char* argv_sz_a[]) bool key_override_b = false; Mudela_key key (0, 0); - Long_option_init long_option_init_a[] = - { - {0, "no-quantify", 'b'}, - {0, "debug", 'D'}, - {0, "help", 'h'}, - {1, "key", 'k'}, - {0, "no-silly", 'n'}, - {1, "output", 'o'}, - {0, "no-tuplets", 'p'}, - {0, "quiet", 'q'}, - {1, "smallest", 's'}, - {0, "no-timestamps", 'T'}, - {0, "verbose", 'v'}, - {0, "warranty", 'w'}, - {0, "no-double-dots", 'x'}, - {0,0,0} - }; + Getopt_long getopt_long (argc_i, argv_sz_a, long_option_init_a); String output_str; while (Long_option_init const* long_option_init_p = getopt_long()) - switch (long_option_init_p->shortname) - { - case 'b': - Duration_convert::no_quantify_b_s = true; - break; - case 'D': - level_ver = DEBUG_ver; - break; - case 'h': - identify(); - usage(); - exit (0); - break; -// case 'I': -// path->push (getopt_long.optional_argument_ch_C_); -// break; - case 'k': - { - String str = getopt_long.optional_argument_ch_C_; - int i = str.index_i (':'); - i = (i >=0 ? i : str.length_i ()); - key.accidentals_i_ = String_convert::dec2_i (str.left_str (i)); - key.minor_i_ = (int)(bool)String_convert::dec2_i (str.cut_str (i + 1, str.length_i ())); - key_override_b = true; - break; - } - case 'n': - Duration_convert::no_double_dots_b_s = true; - Duration_convert::no_triplets_b_s = true; - Duration_convert::no_smaller_than_i_s = 5; - break; - case 'o': - output_str = getopt_long.optional_argument_ch_C_; - break; - case 'p': - Duration_convert::no_triplets_b_s = true; - break; - case 'q': - level_ver = QUIET_ver; - break; - case 'T': - no_timestamps_b_g = true; - break; - case 's': - { - int i = String_convert::dec2_i (getopt_long.optional_argument_ch_C_); - if (!i) - { - identify(); - usage(); - exit (2); //usage - } - Duration_convert::no_smaller_than_i_s = - Duration_convert::i2_type(i); - } - break; - case 'v': - level_ver = VERBOSE_ver; - break; - case 'w': - identify(); - notice(); - exit (0); - break; - case 'x': - Duration_convert::no_double_dots_b_s = true; - break; - default: - assert (0); - break; + switch (long_option_init_p->shortname_ch_) + { + case 'b': + Duration_convert::no_quantify_b_s = true; + break; + case 'd': + level_ver = DEBUG_ver; + break; + case 'h': + usage(); + exit (0); + break; + // case 'I': + // path->push (getopt_long.optional_argument_ch_C_); + // break; + case 'k': + { + String str = getopt_long.optional_argument_ch_C_; + int i = str.index_i (':'); + i = (i >=0 ? i : str.length_i ()); + key.accidentals_i_ = String_convert::dec2_i (str.left_str (i)); + key.minor_i_ = (int)(bool)String_convert::dec2_i (str.cut_str (i + 1, str.length_i ())); + key_override_b = true; + break; + } + case 'n': + Duration_convert::no_double_dots_b_s = true; + Duration_convert::no_triplets_b_s = true; + Duration_convert::no_smaller_than_i_s = 5; + break; + case 'o': + output_str = getopt_long.optional_argument_ch_C_; + break; + case 'p': + Duration_convert::no_triplets_b_s = true; + break; + case 'q': + level_ver = QUIET_ver; + break; + case 'T': + no_timestamps_b_g = true; + break; + case 's': + { + int i = String_convert::dec2_i (getopt_long.optional_argument_ch_C_); + if (!i) + { + identify(); + usage(); + exit (2); //usage } + Duration_convert::no_smaller_than_i_s = + Duration_convert::i2_type(i); + } + break; + case 'v': + level_ver = VERBOSE_ver; + break; + + case 'V': + version (); + exit (0); + break; + case 'w': + identify(); + notice(); + exit (0); + break; + case 'x': + Duration_convert::no_double_dots_b_s = true; + break; + default: + assert (0); + break; + } // flag -q must be checked first identify(); @@ -243,28 +226,28 @@ main (int argc_i, char* argv_sz_a[]) char const* arg_sz = 0; while ( (arg_sz = getopt_long.get_next_arg ())) { - filename_str_g = arg_sz; - Midi_score_parser midi_parser; - Mudela_score* score_p = midi_parser.parse (arg_sz, &source); - - if (!score_p) - return 1; - - // if given on command line: override - if (key_override_b || !score_p->mudela_key_l_) - score_p->mudela_key_l_ = &key; - mudela_score_l_g = score_p; - score_p->process(); - - if (!output_str.length_i ()) - { - String d, dir, base, ext; - split_path (arg_sz, d, dir, base, ext); - output_str = base + ext + ".ly"; - } - - score_p->output (output_str); - delete score_p; + filename_str_g = arg_sz; + Midi_score_parser midi_parser; + Mudela_score* score_p = midi_parser.parse (arg_sz, &source); + + if (!score_p) + return 1; + + // if given on command line: override + if (key_override_b || !score_p->mudela_key_l_) + score_p->mudela_key_l_ = &key; + mudela_score_l_g = score_p; + score_p->process(); + + if (!output_str.length_i ()) + { + String d, dir, base, ext; + split_path (arg_sz, d, dir, base, ext); + output_str = base + ext + ".ly"; + } + + score_p->output (output_str); + delete score_p; } return 0; } diff --git a/midi2ly/version.cc b/midi2ly/version.cc index 6a6306fdab..360b0f886a 100644 --- a/midi2ly/version.cc +++ b/midi2ly/version.cc @@ -3,11 +3,9 @@ const char * midi2ly_version_sz(); -// should simply have Root class... String midi2ly_version_str() { - return String (midi2ly_version_sz ()) - + " " + _("of") + " " + __DATE__ + " " + __TIME__; + return String (midi2ly_version_sz ()); } diff --git a/po/GNUmakefile b/po/GNUmakefile index 2eddf0eeba..f4b7500f5d 100644 --- a/po/GNUmakefile +++ b/po/GNUmakefile @@ -6,6 +6,7 @@ depth = .. NAME = lilypond MODULE_NAME = po +POT_FILES = $(wildcard *.pot) PO_FILES = $(wildcard *.po) MO_FILES = $(addprefix $(outdir)/, $(PO_FILES:.po=.mo)) HELP_CATALOGS = $(PO_FILES:%.po=%) diff --git a/po/it.po b/po/it.po index ad3a0346d4..6b8a5ba49a 100644 --- a/po/it.po +++ b/po/it.po @@ -5,7 +5,7 @@ #, fuzzy msgid "" msgstr "" -"POT-Creation-Date: 1999-08-15 23:58+0200\n" +"POT-Creation-Date: 1999-08-20 18:48+0200\n" "Content-Type: text/plain; charset=\n" "Date: 1998-05-30 00:17:12+0200\n" "From: \n" @@ -29,27 +29,27 @@ msgstr "Non ci sono sufficienti campi in Dstream init." msgid "Debug output disabled. Compiled with NPRINT." msgstr "L'output di debug è disabilitato. Compilato con NPRINT." -#: getopt-long.cc:103 +#: getopt-long.cc:141 #, c-format msgid "option `%s' requires an argument" msgstr "l'opzione `%s' richiede un argomento" -#: getopt-long.cc:107 +#: getopt-long.cc:145 #, c-format msgid "option `%s' doesn't allow an argument" msgstr "opzione `%s' non accetta argomenti" -#: getopt-long.cc:111 +#: getopt-long.cc:149 #, c-format msgid "unrecognized option: `%s'" msgstr "opzione non riconosciuta: `%s'" -#: getopt-long.cc:113 +#: getopt-long.cc:151 #, c-format msgid "%c" msgstr "" -#: getopt-long.cc:117 +#: getopt-long.cc:155 #, c-format msgid "invalid argument `%s' to option `%s'" msgstr "argomento `%s' non valido per l'opzione `%s'" @@ -371,124 +371,147 @@ msgstr "" msgid "Aborting" msgstr "" -#: lookup.cc:434 +#: lookup.cc:436 #, c-format msgid "Non-matching braces in text `%s', adding braces." msgstr "" -#: main.cc:85 -#, c-format -msgid "Usage: %s [OPTION]... [FILE]..." -msgstr "Uso: %s [OPZIONE]... [FILE]..." +#: main.cc:68 +msgid "BASENAME" +msgstr "" -#: main.cc:86 -msgid "Typeset music and or play MIDI from FILE or " -msgstr "Stampa partitura oppure suona una song MIDI da FILE o " +#: main.cc:68 +msgid "write output to BASENAME[-x].extension" +msgstr "" -#: main.cc:47 main.cc:89 -msgid "Options:" -msgstr "Opzioni: " +#: main.cc:69 main.cc:101 +#, fuzzy +msgid "show warranty and copyright" +msgstr " -w, --warranty mostra la garanzia e il copyright\n" -#: main.cc:92 -msgid " -a, --about about LilyPond\n" -msgstr " -a, --about cos'è LilyPond\n" +#: main.cc:70 main.cc:92 +msgid "this help" +msgstr "" -#: main.cc:95 +#: main.cc:71 #, fuzzy -msgid " -d, --debug enable debugging output\n" -msgstr " -D, --debug abilita l'output di debugging\n" +msgid "switch on experimental features" +msgstr " -t, --test usa le caratteristiche sperimentali\n" -#: main.cc:98 +#: main.cc:72 main.cc:91 #, fuzzy -msgid "" -" -M, --dependencies write Makefile dependencies for every input file\n" +msgid "enable debugging output" +msgstr " -D, --debug abilita l'output di debugging\n" + +#: main.cc:73 main.cc:95 +msgid "FILE" msgstr "" -" -d, --dependencies scrive le dependenze del Makefile per ogni file di " -"input\n" -#: main.cc:56 main.cc:101 -msgid " -h, --help this help\n" -msgstr " -h, --help questo help\n" +#: main.cc:73 +#, fuzzy +msgid "use FILE as init file" +msgstr " -i, --init=NOMEFILE usa NOMEFILE come file iniziale\n" -#: main.cc:104 -msgid " -f, --output-format=X use output format X\n" -msgstr " -f, --output-format=X usa il formato dell'ouput X\n" +#: main.cc:74 +msgid "DIR" +msgstr "" -#: main.cc:59 main.cc:107 -msgid " -I, --include=DIR add DIR to search path\n" +#: main.cc:74 +#, fuzzy +msgid "add DIR to search path" msgstr " -I, --include=DIR aggiunge DIR ai path di ricerca\n" -#: main.cc:110 -msgid " -i, --init=FILE use FILE as init file\n" -msgstr " -i, --init=NOMEFILE usa NOMEFILE come file iniziale\n" - -#: main.cc:113 +#: main.cc:75 #, fuzzy -msgid " -m, --no-paper produce midi output only\n" +msgid "produce midi output only" msgstr " -M, --no-paper produce solo output midi\n" -#: main.cc:116 -msgid " -o, --output=FILE set FILE as default output base\n" +#: main.cc:76 +#, fuzzy +msgid "write Makefile dependencies for every input file" msgstr "" -" -o, --output=FILE indica FILE come base di default per l'output\n" +" -d, --dependencies scrive le dependenze del Makefile per ogni file di " +"input\n" -#: main.cc:119 -msgid " -Q, --find-old-relative show all changes in relative syntax\n" +#: main.cc:77 main.cc:99 +#, fuzzy +msgid "don't timestamp the output" +msgstr "" +" -T, --no-timestamps non inserisce marcatori temporali nell'output\n" + +#: main.cc:78 +#, fuzzy +msgid "show all changes in relative syntax" msgstr "" " -Q, --find-old-relative mostra tutti i cambiamenti nella sintassi " "relativa\n" -#: main.cc:122 -msgid "" -" -s, --safe inhibit file output naming and exporting TeX " -"macros\n" +#: main.cc:79 +#, fuzzy +msgid "ignore mudela version" +msgstr "versione di mudela errata: %s (%s, %s)" + +#: main.cc:80 main.cc:103 +msgid "print version number" msgstr "" -" -s, --safe inibisce la rinomina dei file di output e " -"l'esportazione di macro di TeX\n" -#: main.cc:124 -msgid " -t, --test switch on experimental features\n" -msgstr " -t, --test usa le caratteristiche sperimentali\n" +#: main.cc:81 +msgid "EXT" +msgstr "" -#: main.cc:77 main.cc:127 -msgid " -T, --no-timestamps don't timestamp the output\n" +#: main.cc:81 +msgid "use output format EXT" msgstr "" -" -T, --no-timestamps non inserisce marcatori temporali nell'output\n" -#: main.cc:130 -msgid " -V, --ignore-version ignore mudela version\n" -msgstr " -V, --ignore-version ignora la versione di mudela\n" +#: main.cc:82 +#, fuzzy +msgid "inhibit file output naming and exporting" +msgstr "" +" -s, --safe inibisce la rinomina dei file di output e " +"l'esportazione di macro di TeX\n" -#: main.cc:86 main.cc:133 -msgid " -w, --warranty show warranty and copyright\n" -msgstr " -w, --warranty mostra la garanzia e il copyright\n" +#: main.cc:89 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]..." +msgstr "Uso: %s [OPZIONE]... [FILE]..." -#: main.cc:136 -msgid "GNU LilyPond was compiled with the following settings:" -msgstr "GNU LilyPond è stata compilata con le seguenti impostazioni:" +#: main.cc:91 +#, fuzzy +msgid "Typeset music and or play MIDI from FILE." +msgstr "Stampa partitura oppure suona una song MIDI da FILE o " -#: main.cc:166 -msgid "GNU LilyPond is Free software, see --warranty" -msgstr "GNU LilyPond è Free software, vedi --warranty" +#: main.cc:97 main.cc:115 +msgid "Options:" +msgstr "Opzioni: " -#: main.cc:106 main.cc:169 main.cc:182 -#, c-format -msgid "Copyright (c) %s by" -msgstr "Copyright (c) %s di" +#: main.cc:101 +#, fuzzy +msgid "This binary was compiled with the following options:" +msgstr "GNU LilyPond è stata compilata con le seguenti impostazioni:" -#: main.cc:108 main.cc:171 main.cc:184 -msgid "Han-Wen Nienhuys " +#: main.cc:118 main.cc:119 +msgid "Report bugs to" msgstr "" -#: main.cc:109 main.cc:172 main.cc:185 -msgid "Jan Nieuwenhuizen " +#: main.cc:52 main.cc:134 +#, c-format +msgid "" +"This is free software. It is covered by the GNU General Public License,and " +"you are welcome to change it and/or distribute copies of it undercertain " +"conditions. Invoke as `%s --warranty' for more information.\n" msgstr "" -#: main.cc:180 +#: main.cc:59 main.cc:141 main.cc:153 +#, c-format +msgid "Copyright (c) %s by" +msgstr "Copyright (c) %s di" + +#. GNU GNU? +#: main.cc:151 msgid "GNU LilyPond -- The GNU Project music typesetter" msgstr "GNU LilyPond -- Il tipografo musicale del progetto GNU" -#: main.cc:112 main.cc:188 +#: main.cc:68 main.cc:159 msgid "" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -973,7 +996,6 @@ msgid "" "using a high level description file as input. LilyPond is part of \n" "the GNU Project.\n" "\n" -"\n" msgstr "" #: out/COPERTINA.hh:2 @@ -992,78 +1014,73 @@ msgstr "" #: out/FLAPTEKST.hh:2 msgid "" -"LilyPond is de muziekzetter van het GNU Project. Dit programma drukt\n" -"prachtige bladmuziek volgens een muzikaal definitie bestand. Ook kan\n" -"het een mechanische uitvoering afspelen naar een MIDI bestand.\n" -"Bijzondere kunstjes zijn verscheidene notenbalken, maatsoorten, sleutels, \n" -"toonaarden, zangteksten, krachtige invoer taal, cadensa, balken, boogjes, \n" -"triolen, accoordnamen, transponeren, partituren, en uittreksels voor \n" -"individuele partijen. Een fraaie set muziektekens is inbegrepen.\n" +"LilyPond is een muziekzetter. Zij maakt prachtige bladmuziek\n" +"uitgaande van een hoog niveau beschrijving bestand. LilyPond \n" +"maakt deel uit van het GNU Project.\n" msgstr "" -#: main.cc:42 -#, c-format -msgid "Usage: %s [OPTION]... [FILE]" -msgstr "Uso: %s [OPZIONE... [FILE]" - -#: main.cc:44 -msgid "Translate midi-file to mudela" -msgstr "Traduce un file midi in mudela" - -#: main.cc:50 -msgid " -b, --no-quantify write exact durations, e.g.: a4*385/384\n" +#: main.cc:90 +#, fuzzy +msgid "write exact durations, e.g.: a4*385/384" msgstr " -b, --no-quantify scrive durate esatte, p.es.: a4*385/384\n" -#: main.cc:53 -msgid " -D, --debug enable debugging output\n" -msgstr " -D, --debug abilita l'output di debugging\n" +#: main.cc:93 +msgid "ACC[:MINOR]" +msgstr "" -#: main.cc:62 -msgid " -k, --key=ACC[:MINOR] set key: ACC +sharps/-flats; :1 minor\n" +#: main.cc:93 +#, fuzzy +msgid "set key: ACC +sharps/-flats; :1 minor" msgstr "" " -k, --key=ACC[:MINOR] imposta l'armatura: ACC +diesis/-bemolli; :1 minore\n" -#: main.cc:65 +#: main.cc:94 #, fuzzy -msgid "" -" -n, --no-silly assume no tuplets or double dots, smallest is 32\n" +msgid "assume no tuplets or double dots, smallest is 32" msgstr "" " -n, --no-silly assume che non ci siano gruppetti o doppi punti, la " "figura più piccola è 32\n" -#: main.cc:68 -msgid " -o, --output=FILE set FILE as default output\n" +#: main.cc:95 +#, fuzzy +msgid "set FILE as default output" msgstr " -o, --output=FILE set FILE come output di default\n" -#: main.cc:71 -#, fuzzy -msgid " -p, --no-tuplets assume no tuplets\n" -msgstr " -p, --no-plets assume che non ci siano gruppetti\n" +#: main.cc:96 +msgid "assume no tuplets" +msgstr "" -#: main.cc:74 -msgid " -q, --quiet be quiet\n" -msgstr " -q, --quiet sii silenzioso\n" +#: main.cc:97 +msgid "be quiet" +msgstr "" -#: main.cc:80 -msgid "" -" -s, --smallest=N assume no shorter (reciprocal) durations than N\n" +#: main.cc:98 +msgid "DUR" msgstr "" -" -s, --smallest=N assume che non ci siano durate (reciproche) " -"inferiori a N\n" -#: main.cc:83 -msgid " -v, --verbose be verbose\n" -msgstr " -v, --verbose sii loquace\n" +#: main.cc:98 +#, fuzzy +msgid "Set smallest duration (?)" +msgstr "indicazione durata priva di senso" -#: main.cc:89 -msgid " -x, --no-double-dots assume no double dotted notes\n" +#: main.cc:100 +msgid "be verbose" msgstr "" -" -x, --no-double-dots assume che non ci siano note con doppio punto\n" -#: main.cc:104 +#: main.cc:102 #, fuzzy -msgid "Midi2ly, translate midi to mudela" -msgstr "Mi2mu, tradice midi in mudela" +msgid "assume no double dotted notes" +msgstr "" +" -x, --no-double-dots assume che non ci siano note con doppio punto\n" + +#: main.cc:110 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]" +msgstr "Uso: %s [OPZIONE... [FILE]" + +#: main.cc:112 +msgid "Translate midi-file to mudela" +msgstr "Traduce un file midi in mudela" #: midi-parser.cc:64 msgid "zero length string encountered" @@ -1189,9 +1206,59 @@ msgstr "% Generato automaticamente" msgid "% from input file: " msgstr "% dal file di input: " -#: version.cc:11 -msgid "of" -msgstr "di" +#, fuzzy +#~ msgid "enable debugging output " +#~ msgstr " -D, --debug abilita l'output di debugging\n" + +#, fuzzy +#~ msgid "don't timestamp the output " +#~ msgstr "" +#~ " -T, --no-timestamps non inserisce marcatori temporali nell'output\n" + +#~ msgid " -a, --about about LilyPond\n" +#~ msgstr " -a, --about cos'è LilyPond\n" + +#~ msgid " -h, --help this help\n" +#~ msgstr " -h, --help questo help\n" + +#~ msgid " -f, --output-format=X use output format X\n" +#~ msgstr " -f, --output-format=X usa il formato dell'ouput X\n" + +#~ msgid " -o, --output=FILE set FILE as default output base\n" +#~ msgstr "" +#~ " -o, --output=FILE indica FILE come base di default per l'output\n" + +#~ msgid " -V, --ignore-version ignore mudela version\n" +#~ msgstr " -V, --ignore-version ignora la versione di mudela\n" + +#~ msgid "GNU LilyPond is Free software, see --warranty" +#~ msgstr "GNU LilyPond è Free software, vedi --warranty" + +#~ msgid " -D, --debug enable debugging output\n" +#~ msgstr " -D, --debug abilita l'output di debugging\n" + +#, fuzzy +#~ msgid " -p, --no-tuplets assume no tuplets\n" +#~ msgstr " -p, --no-plets assume che non ci siano gruppetti\n" + +#~ msgid " -q, --quiet be quiet\n" +#~ msgstr " -q, --quiet sii silenzioso\n" + +#~ msgid "" +#~ " -s, --smallest=N assume no shorter (reciprocal) durations than N\n" +#~ msgstr "" +#~ " -s, --smallest=N assume che non ci siano durate (reciproche) " +#~ "inferiori a N\n" + +#~ msgid " -v, --verbose be verbose\n" +#~ msgstr " -v, --verbose sii loquace\n" + +#, fuzzy +#~ msgid "Midi2ly, translate midi to mudela" +#~ msgstr "Mi2mu, tradice midi in mudela" + +#~ msgid "of" +#~ msgstr "di" #~ msgid "please fix me" #~ msgstr "correggimi, per favore" diff --git a/po/lilypond.po b/po/lilypond.po index 23a27594e6..66cadce854 100644 --- a/po/lilypond.po +++ b/po/lilypond.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-08-15 23:58+0200\n" +"POT-Creation-Date: 1999-08-20 18:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -30,27 +30,27 @@ msgstr "" msgid "Debug output disabled. Compiled with NPRINT." msgstr "" -#: getopt-long.cc:103 +#: getopt-long.cc:141 #, c-format msgid "option `%s' requires an argument" msgstr "" -#: getopt-long.cc:107 +#: getopt-long.cc:145 #, c-format msgid "option `%s' doesn't allow an argument" msgstr "" -#: getopt-long.cc:111 +#: getopt-long.cc:149 #, c-format msgid "unrecognized option: `%s'" msgstr "" -#: getopt-long.cc:113 +#: getopt-long.cc:151 #, c-format msgid "%c" msgstr "" -#: getopt-long.cc:117 +#: getopt-long.cc:155 #, c-format msgid "invalid argument `%s' to option `%s'" msgstr "" @@ -370,113 +370,127 @@ msgstr "" msgid "Aborting" msgstr "" -#: lookup.cc:434 +#: lookup.cc:436 #, c-format msgid "Non-matching braces in text `%s', adding braces." msgstr "" -#: main.cc:85 -#, c-format -msgid "Usage: %s [OPTION]... [FILE]..." +#: main.cc:68 +msgid "BASENAME" msgstr "" -#: main.cc:86 -msgid "Typeset music and or play MIDI from FILE or " +#: main.cc:68 +msgid "write output to BASENAME[-x].extension" msgstr "" -#: main.cc:47 main.cc:89 -msgid "Options:" +#: main.cc:69 main.cc:101 +msgid "show warranty and copyright" msgstr "" -#: main.cc:92 -msgid " -a, --about about LilyPond\n" +#: main.cc:70 main.cc:92 +msgid "this help" msgstr "" -#: main.cc:95 -msgid " -d, --debug enable debugging output\n" +#: main.cc:71 +msgid "switch on experimental features" msgstr "" -#: main.cc:98 -msgid "" -" -M, --dependencies write Makefile dependencies for every input file\n" +#: main.cc:72 main.cc:91 +msgid "enable debugging output" msgstr "" -#: main.cc:56 main.cc:101 -msgid " -h, --help this help\n" +#: main.cc:73 main.cc:95 +msgid "FILE" msgstr "" -#: main.cc:104 -msgid " -f, --output-format=X use output format X\n" +#: main.cc:73 +msgid "use FILE as init file" msgstr "" -#: main.cc:59 main.cc:107 -msgid " -I, --include=DIR add DIR to search path\n" +#: main.cc:74 +msgid "DIR" msgstr "" -#: main.cc:110 -msgid " -i, --init=FILE use FILE as init file\n" +#: main.cc:74 +msgid "add DIR to search path" msgstr "" -#: main.cc:113 -msgid " -m, --no-paper produce midi output only\n" +#: main.cc:75 +msgid "produce midi output only" msgstr "" -#: main.cc:116 -msgid " -o, --output=FILE set FILE as default output base\n" +#: main.cc:76 +msgid "write Makefile dependencies for every input file" msgstr "" -#: main.cc:119 -msgid " -Q, --find-old-relative show all changes in relative syntax\n" +#: main.cc:77 main.cc:99 +msgid "don't timestamp the output" msgstr "" -#: main.cc:122 -msgid "" -" -s, --safe inhibit file output naming and exporting TeX " -"macros\n" +#: main.cc:78 +msgid "show all changes in relative syntax" msgstr "" -#: main.cc:124 -msgid " -t, --test switch on experimental features\n" +#: main.cc:79 +msgid "ignore mudela version" msgstr "" -#: main.cc:77 main.cc:127 -msgid " -T, --no-timestamps don't timestamp the output\n" +#: main.cc:80 main.cc:103 +msgid "print version number" msgstr "" -#: main.cc:130 -msgid " -V, --ignore-version ignore mudela version\n" +#: main.cc:81 +msgid "EXT" msgstr "" -#: main.cc:86 main.cc:133 -msgid " -w, --warranty show warranty and copyright\n" +#: main.cc:81 +msgid "use output format EXT" msgstr "" -#: main.cc:136 -msgid "GNU LilyPond was compiled with the following settings:" +#: main.cc:82 +msgid "inhibit file output naming and exporting" msgstr "" -#: main.cc:166 -msgid "GNU LilyPond is Free software, see --warranty" +#: main.cc:89 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]..." msgstr "" -#: main.cc:106 main.cc:169 main.cc:182 -#, c-format -msgid "Copyright (c) %s by" +#: main.cc:91 +msgid "Typeset music and or play MIDI from FILE." +msgstr "" + +#: main.cc:97 main.cc:115 +msgid "Options:" +msgstr "" + +#: main.cc:101 +msgid "This binary was compiled with the following options:" +msgstr "" + +#: main.cc:118 main.cc:119 +msgid "Report bugs to" msgstr "" -#: main.cc:108 main.cc:171 main.cc:184 -msgid "Han-Wen Nienhuys " +#: main.cc:52 main.cc:134 +#, c-format +msgid "" +"This is free software. It is covered by the GNU General Public License,and " +"you are welcome to change it and/or distribute copies of it undercertain " +"conditions. Invoke as `%s --warranty' for more information.\n" msgstr "" -#: main.cc:109 main.cc:172 main.cc:185 -msgid "Jan Nieuwenhuizen " +#: main.cc:59 main.cc:141 main.cc:153 +#, c-format +msgid "Copyright (c) %s by" msgstr "" -#: main.cc:180 +#. GNU GNU? +#: main.cc:151 msgid "GNU LilyPond -- The GNU Project music typesetter" msgstr "" -#: main.cc:112 main.cc:188 +#: main.cc:68 main.cc:159 msgid "" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -940,7 +954,6 @@ msgid "" "using a high level description file as input. LilyPond is part of \n" "the GNU Project.\n" "\n" -"\n" msgstr "" #: out/COPERTINA.hh:2 @@ -959,68 +972,62 @@ msgstr "" #: out/FLAPTEKST.hh:2 msgid "" -"LilyPond is de muziekzetter van het GNU Project. Dit programma drukt\n" -"prachtige bladmuziek volgens een muzikaal definitie bestand. Ook kan\n" -"het een mechanische uitvoering afspelen naar een MIDI bestand.\n" -"Bijzondere kunstjes zijn verscheidene notenbalken, maatsoorten, sleutels, \n" -"toonaarden, zangteksten, krachtige invoer taal, cadensa, balken, boogjes, \n" -"triolen, accoordnamen, transponeren, partituren, en uittreksels voor \n" -"individuele partijen. Een fraaie set muziektekens is inbegrepen.\n" +"LilyPond is een muziekzetter. Zij maakt prachtige bladmuziek\n" +"uitgaande van een hoog niveau beschrijving bestand. LilyPond \n" +"maakt deel uit van het GNU Project.\n" msgstr "" -#: main.cc:42 -#, c-format -msgid "Usage: %s [OPTION]... [FILE]" +#: main.cc:90 +msgid "write exact durations, e.g.: a4*385/384" msgstr "" -#: main.cc:44 -msgid "Translate midi-file to mudela" +#: main.cc:93 +msgid "ACC[:MINOR]" msgstr "" -#: main.cc:50 -msgid " -b, --no-quantify write exact durations, e.g.: a4*385/384\n" +#: main.cc:93 +msgid "set key: ACC +sharps/-flats; :1 minor" msgstr "" -#: main.cc:53 -msgid " -D, --debug enable debugging output\n" +#: main.cc:94 +msgid "assume no tuplets or double dots, smallest is 32" msgstr "" -#: main.cc:62 -msgid " -k, --key=ACC[:MINOR] set key: ACC +sharps/-flats; :1 minor\n" +#: main.cc:95 +msgid "set FILE as default output" msgstr "" -#: main.cc:65 -msgid "" -" -n, --no-silly assume no tuplets or double dots, smallest is 32\n" +#: main.cc:96 +msgid "assume no tuplets" msgstr "" -#: main.cc:68 -msgid " -o, --output=FILE set FILE as default output\n" +#: main.cc:97 +msgid "be quiet" msgstr "" -#: main.cc:71 -msgid " -p, --no-tuplets assume no tuplets\n" +#: main.cc:98 +msgid "DUR" msgstr "" -#: main.cc:74 -msgid " -q, --quiet be quiet\n" +#: main.cc:98 +msgid "Set smallest duration (?)" msgstr "" -#: main.cc:80 -msgid "" -" -s, --smallest=N assume no shorter (reciprocal) durations than N\n" +#: main.cc:100 +msgid "be verbose" msgstr "" -#: main.cc:83 -msgid " -v, --verbose be verbose\n" +#: main.cc:102 +msgid "assume no double dotted notes" msgstr "" -#: main.cc:89 -msgid " -x, --no-double-dots assume no double dotted notes\n" +#: main.cc:110 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]" msgstr "" -#: main.cc:104 -msgid "Midi2ly, translate midi to mudela" +#: main.cc:112 +msgid "Translate midi-file to mudela" msgstr "" #: midi-parser.cc:64 @@ -1146,7 +1153,3 @@ msgstr "" #, c-format msgid "% from input file: " msgstr "" - -#: version.cc:11 -msgid "of" -msgstr "" diff --git a/po/nl.po b/po/nl.po index e32dcdb374..1f5dfdd10c 100644 --- a/po/nl.po +++ b/po/nl.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"POT-Creation-Date: 1999-08-15 23:58+0200\n" +"POT-Creation-Date: 1999-08-20 18:48+0200\n" "Content-Type: text/plain; charset=\n" "Date: 1998-05-26 11:26:28+0200\n" "From: \n" @@ -28,27 +28,27 @@ msgstr "Onvoldoende velden in Dstream init." msgid "Debug output disabled. Compiled with NPRINT." msgstr "Ontluis berichten zijn uitgeschakeld. Vertaald met NPRINT." -#: getopt-long.cc:103 +#: getopt-long.cc:141 #, c-format msgid "option `%s' requires an argument" msgstr "optie `%s' vereist een argument" -#: getopt-long.cc:107 +#: getopt-long.cc:145 #, c-format msgid "option `%s' doesn't allow an argument" msgstr "optie `%s' staat geen argument toe" -#: getopt-long.cc:111 +#: getopt-long.cc:149 #, c-format msgid "unrecognized option: `%s'" msgstr "onbekende optie: `%s'" -#: getopt-long.cc:113 +#: getopt-long.cc:151 #, c-format msgid "%c" msgstr "" -#: getopt-long.cc:117 +#: getopt-long.cc:155 #, c-format msgid "invalid argument `%s' to option `%s'" msgstr "onjuist argument: `%s' voor optie `%s'" @@ -368,117 +368,127 @@ msgstr "" msgid "Aborting" msgstr "" -#: lookup.cc:434 +#: lookup.cc:436 #, c-format msgid "Non-matching braces in text `%s', adding braces." msgstr "" -#: main.cc:85 -#, c-format -msgid "Usage: %s [OPTION]... [FILE]..." -msgstr "Gebruik: %s [OPTIE]... [BESTAND]..." - -#: main.cc:86 -msgid "Typeset music and or play MIDI from FILE or " -msgstr "Zet muziek en of speel MIDI van FILE of " +#: main.cc:68 +msgid "BASENAME" +msgstr "BASISNAAM" -#: main.cc:47 main.cc:89 -msgid "Options:" -msgstr "Opties:" +#: main.cc:68 +msgid "write output to BASENAME[-x].extension" +msgstr "schrijf uitvoer naar BASISNAME[-x].extensie" -#: main.cc:92 -msgid " -a, --about about LilyPond\n" -msgstr " -a, --about over LilyPond\n" +#: main.cc:69 main.cc:101 +msgid "show warranty and copyright" +msgstr "toon garantie en copyright" -#: main.cc:95 -msgid " -d, --debug enable debugging output\n" -msgstr " -D, --debug toon ontluis berichten\n" +#: main.cc:70 main.cc:92 +msgid "this help" +msgstr "deze hulp" -#: main.cc:98 -msgid "" -" -M, --dependencies write Makefile dependencies for every input file\n" -msgstr "" -" -d, --dependencies schrijf Makefile afhankelijkheden voor elk\n" -" invoerbestand\n" +#: main.cc:71 +msgid "switch on experimental features" +msgstr "doe experimentele kunstjes" -#: main.cc:56 main.cc:101 -msgid " -h, --help this help\n" -msgstr " -h, --help deze hulp\n" +#: main.cc:72 main.cc:91 +msgid "enable debugging output" +msgstr "toon ontluis berichten" -#: main.cc:104 -msgid " -f, --output-format=X use output format X\n" -msgstr " -f, --output-format=X gebruik uitvoer formaat X\n" +#: main.cc:73 main.cc:95 +msgid "FILE" +msgstr "BESTAND" -#: main.cc:59 main.cc:107 -msgid " -I, --include=DIR add DIR to search path\n" -msgstr " -I, --include=INDEX voeg INDEX toe aan zoekpad\n" +#: main.cc:73 +msgid "use FILE as init file" +msgstr "gebruik BESTAND als initialisatiebestand" -#: main.cc:110 -msgid " -i, --init=FILE use FILE as init file\n" -msgstr " -i, --init=BESTAND gebruik BESTAND als initialisatiebestand\n" +#: main.cc:74 +msgid "DIR" +msgstr "DIR" -#: main.cc:113 -msgid " -m, --no-paper produce midi output only\n" -msgstr " -M, --no-paper produceer alleen midi uitvoer\n" +#: main.cc:74 +msgid "add DIR to search path" +msgstr "voeg DIR toe aan zoekpad" -#: main.cc:116 -msgid " -o, --output=FILE set FILE as default output base\n" -msgstr " -o, --output=BESTAND zet BESTAND als uitvoer basis\n" +#: main.cc:75 +msgid "produce midi output only" +msgstr "produceer alleen midi uitvoer" -#: main.cc:119 -msgid " -Q, --find-old-relative show all changes in relative syntax\n" -msgstr " -Q, --find-old-relative toon veranderingen voor relatieve mode\n" +#: main.cc:76 +msgid "write Makefile dependencies for every input file" +msgstr "schrijf Makefile afhankelijkheden voor elk invoerbestand" -#: main.cc:122 -msgid "" -" -s, --safe inhibit file output naming and exporting TeX " -"macros\n" -msgstr "" -" -s, --safe verbiedt naamgeving van uitvoer bestand en TeX " -"macro's\n" +#: main.cc:77 main.cc:99 +msgid "don't timestamp the output" +msgstr "geen tijdstempel in de uitvoer" -#: main.cc:124 -msgid " -t, --test switch on experimental features\n" -msgstr " -t, --test doe experimentele kunstjes\n" +#: main.cc:78 +msgid "show all changes in relative syntax" +msgstr "toon veranderingen voor relatieve mode" -#: main.cc:77 main.cc:127 -msgid " -T, --no-timestamps don't timestamp the output\n" -msgstr " -T, --no-timestamps zet geen tijdstempel in de uitvoer\n" +#: main.cc:79 +msgid "ignore mudela version" +msgstr "verkeerde mudela versie: %s (%s, %s)" -#: main.cc:130 -msgid " -V, --ignore-version ignore mudela version\n" -msgstr " -V, --ignore-version negeer mudela versie\n" +#: main.cc:80 main.cc:103 +msgid "print version number" +msgstr "toon versienummer" -#: main.cc:86 main.cc:133 -msgid " -w, --warranty show warranty and copyright\n" -msgstr " -w, --warranty toon garantie en copyright\n" +#: main.cc:81 +msgid "EXT" +msgstr "EXT" -#: main.cc:136 -msgid "GNU LilyPond was compiled with the following settings:" -msgstr "GNU LilyPond is vertaald met de volgende instellingen:" +#: main.cc:81 +msgid "use output format EXT" +msgstr "gebruik uitvoer formaat EXT" -#: main.cc:166 -msgid "GNU LilyPond is Free software, see --warranty" -msgstr "GNU LilyPond is Vrij bedenksel, zie --warranty" +#: main.cc:82 +msgid "inhibit file output naming and exporting" +msgstr "verbiedt naamgeving van uitvoer bestand en TeX macro's" -#: main.cc:106 main.cc:169 main.cc:182 +#: main.cc:89 #, c-format -msgid "Copyright (c) %s by" -msgstr "Copyright (c) %s " +msgid "Usage: %s [OPTION]... [FILE]..." +msgstr "Gebruik: %s [OPTIE]... [BESTAND]..." -#: main.cc:108 main.cc:171 main.cc:184 -msgid "Han-Wen Nienhuys " -msgstr "" +#: main.cc:91 +msgid "Typeset music and or play MIDI from FILE." +msgstr "Zet muziek en of speel MIDI van FILE of " + +#: main.cc:97 main.cc:115 +msgid "Options:" +msgstr "Opties:" + +#: main.cc:101 +msgid "This binary was compiled with the following options:" +msgstr "Dit programma is vertaald met de volgende instellingen:" + +#: main.cc:118 main.cc:119 +msgid "Report bugs to" +msgstr "Rapporteer bugs naar" -#: main.cc:109 main.cc:172 main.cc:185 -msgid "Jan Nieuwenhuizen " +#: main.cc:52 main.cc:134 +#, c-format +msgid "" +"This is free software. It is covered by the GNU General Public License,and " +"you are welcome to change it and/or distribute copies of it undercertain " +"conditions. Invoke as `%s --warranty' for more information.\n" msgstr "" -#: main.cc:180 +#: main.cc:59 main.cc:141 main.cc:153 +#, c-format +msgid "Copyright (c) %s by" +msgstr "Copyright (c) %s " + +#. GNU GNU? +#: main.cc:151 msgid "GNU LilyPond -- The GNU Project music typesetter" msgstr "GNU LilyPond -- De Muziekzetter van het GNU Project" -#: main.cc:112 main.cc:188 +#: main.cc:68 main.cc:159 msgid "" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -872,7 +882,7 @@ msgstr "Ik ben te dik." #: parser.yy:55 #, c-format msgid "Oldest supported input version: %s" -msgstr "" +msgstr "Oudst ondersteunde invoer versie: %s" #: parser.yy:313 msgid "Cannot evaluate Scheme in safe mode" @@ -955,8 +965,11 @@ msgid "" "using a high level description file as input. LilyPond is part of \n" "the GNU Project.\n" "\n" -"\n" msgstr "" +"LilyPond is een muziekzetter. Zij maakt prachtige bladmuziek\n" +"uitgaande van een hoog niveau beschrijving bestand. LilyPond \n" +"maakt deel uit van het GNU Project.\n" +"\n" #: out/COPERTINA.hh:2 msgid "" @@ -974,70 +987,63 @@ msgstr "" #: out/FLAPTEKST.hh:2 msgid "" -"LilyPond is de muziekzetter van het GNU Project. Dit programma drukt\n" -"prachtige bladmuziek volgens een muzikaal definitie bestand. Ook kan\n" -"het een mechanische uitvoering afspelen naar een MIDI bestand.\n" -"Bijzondere kunstjes zijn verscheidene notenbalken, maatsoorten, sleutels, \n" -"toonaarden, zangteksten, krachtige invoer taal, cadensa, balken, boogjes, \n" -"triolen, accoordnamen, transponeren, partituren, en uittreksels voor \n" -"individuele partijen. Een fraaie set muziektekens is inbegrepen.\n" +"LilyPond is een muziekzetter. Zij maakt prachtige bladmuziek\n" +"uitgaande van een hoog niveau beschrijving bestand. LilyPond \n" +"maakt deel uit van het GNU Project.\n" msgstr "" -#: main.cc:42 -#, c-format -msgid "Usage: %s [OPTION]... [FILE]" -msgstr "Gebruik: %s [OPTIE]... [BESTAND]" +#: main.cc:90 +msgid "write exact durations, e.g.: a4*385/384" +msgstr "schrijf exacte duren, bijv.: a4*385/384" -#: main.cc:44 -msgid "Translate midi-file to mudela" -msgstr "Vertaal midi-bestand naar mudela" +#: main.cc:93 +msgid "ACC[:MINOR]" +msgstr "ACC[:MINEUR]" -#: main.cc:50 -msgid " -b, --no-quantify write exact durations, e.g.: a4*385/384\n" -msgstr " -b, --no-quantify schrijf exacte duren, bijv.: a4*385/384\n" +#: main.cc:93 +msgid "set key: ACC +sharps/-flats; :1 minor" +msgstr "zet toonsoort: ACC +kruizen/-mollen; :1 mineur" -#: main.cc:53 -msgid " -D, --debug enable debugging output\n" -msgstr " -D, --debug toon ontluis berichten\n" +#: main.cc:94 +msgid "assume no tuplets or double dots, smallest is 32" +msgstr "ga niet uit van tuplets of dubbel gepunkteerd, kortste is 32" -#: main.cc:62 -msgid " -k, --key=ACC[:MINOR] set key: ACC +sharps/-flats; :1 minor\n" -msgstr " -k, --key=ACC[:MINEUR] zet toonsoort: ACC +kruizen/-mollen; :1 mineur\n" +#: main.cc:95 +msgid "set FILE as default output" +msgstr "zet BESTAND als verval uitvoer" -#: main.cc:65 -msgid "" -" -n, --no-silly assume no tuplets or double dots, smallest is 32\n" -msgstr " -n, --no-silly ga niet uit van tuplets of dubbel gepunteerd, " -" kortste is 32\n" +#: main.cc:96 +msgid "assume no tuplets" +msgstr "ga niet uit van tuplets" -#: main.cc:68 -msgid " -o, --output=FILE set FILE as default output\n" -msgstr " -o, --output=BESTAND zet BESTAND als verval uitvoer\n" +#: main.cc:97 +msgid "be quiet" +msgstr "wees stil" -#: main.cc:71 -msgid " -p, --no-tuplets assume no tuplets\n" -msgstr " -p, --no-tuplets ga uit van geen tuplets\n" +#: main.cc:98 +msgid "DUR" +msgstr "DUUR" -#: main.cc:74 -msgid " -q, --quiet be quiet\n" -msgstr " -q, --quiet wees stil\n" +#: main.cc:98 +msgid "Set smallest duration (?)" +msgstr "Zet kortste duur (?)" -#: main.cc:80 -msgid "" -" -s, --smallest=N assume no shorter (reciprocal) durations than N\n" -msgstr " -s, --smallest=N ga niet uit van kortere (reciproke) duren dan N\n" +#: main.cc:100 +msgid "be verbose" +msgstr "wees breedsprakig" -#: main.cc:83 -msgid " -v, --verbose be verbose\n" -msgstr " -v, --verbose wees breedsprakig\n" +#: main.cc:102 +msgid "assume no double dotted notes" +msgstr "ga niet uit van dubbel gepunkteerde noten" -#: main.cc:89 -msgid " -x, --no-double-dots assume no double dotted notes\n" -msgstr " -x, --no-double-dots ga niet uit van dubbel gepunkteerde noten\n" +#: main.cc:110 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]" +msgstr "Gebruik: %s [OPTIE]... [BESTAND]" -#: main.cc:104 -msgid "Midi2ly, translate midi to mudela" -msgstr "Midi2ly, vertaal midi naar mudela" +#: main.cc:112 +msgid "Translate midi-file to mudela" +msgstr "Vertaal midi-bestand naar mudela" #: midi-parser.cc:64 msgid "zero length string encountered" @@ -1163,9 +1169,17 @@ msgstr "" msgid "% from input file: " msgstr "" -#: version.cc:11 -msgid "of" -msgstr "van" +#~ msgid "this help " +#~ msgstr "deze hulp" + +#~ msgid "GNU LilyPond is Free Software, see --warranty" +#~ msgstr "GNU LilyPond is Vrij bedenksel, zie --warranty" + +#~ msgid "Midi2ly, translate midi to mudela" +#~ msgstr "Midi2ly, vertaal midi naar mudela" + +#~ msgid "of" +#~ msgstr "van" #~ msgid "please fix me" #~ msgstr "repareer mij alsjeblieft" diff --git a/scripts/convert-mudela.py b/scripts/convert-mudela.py index 09bc18962e..983abe0adf 100644 --- a/scripts/convert-mudela.py +++ b/scripts/convert-mudela.py @@ -14,7 +14,7 @@ # - rewrite in python program_name = 'convert-mudela' -version = '0.4' +version = '@TOPLEVEL_VERSION@' import os import sys @@ -28,11 +28,43 @@ mudela_version_re_str = '\\\\version *\"(.*)\"' mudela_version_re = re.compile(mudela_version_re_str) def program_id (): - return '%s version %s' %(program_name, version); + return '%s (GNU LilyPond) %s' %(program_name, version); def identify (): sys.stderr.write (program_id () + '\n') +def usage (): + sys.stdout.write ( + r"""Usage: %s [OPTION]... [FILE]... +Try to convert to newer mudela-versions. The version number of the +input is guessed by default from \version directive + +Options: + -h, --help print this help + -e, --edit in place edit + -f, --from=VERSION start from version + -s, --show-rules print all rules. + -t, --to=VERSION target version + --version print program version + +Report bugs to bugs-gnu-music@gnu.org + +""" % program_name) + + + sys.exit (0) + +def print_version (): + + sys.stdout.write (r"""%s + +This is free software. It is covered by the GNU General Public +License, and you are welcome to change it and/or distribute copies of +it under certain conditions. invoke as `%s --warranty' for more +information. + +""" % (program_id() , program_name)) + def gulp_file(f): try: i = open(f) @@ -59,7 +91,6 @@ def version_cmp (t1, t2): if t1[x] - t2[x]: return t1[x] - t2[x] return 0 - def guess_mudela_version(filename): s = gulp_file (filename) @@ -69,18 +100,6 @@ def guess_mudela_version(filename): else: return '' -def help (): - sys.stdout.write ( - ("Usage: %s [OPTION]... [FILE]...\n" - + "Try to convert to newer mudela-versions\n" - + "Options:\n" - + " -h, --help print this help\n" - + ' -e, --edit in place edit\n' - + ' -f, --from=VERSION start from version\n' - + ' -s, --show-rules print out all rules.\n' - + ' -t, --to=VERSION target version\n') % program_name) - sys.exit (0) - class FatalConversionError: pass @@ -94,16 +113,11 @@ def show_rules (file): if 1: # need new a namespace def conv (lines): - found =0 - for x in lines: - if re.search ('\\\\octave', x): - found = 1 - break - if found: + if re.search ('\\\\octave', str): sys.stderr.write ('\nNot smart enough to convert \\octave') raise FatalConversionError() - return lines + return lines conversions.append ( ((0,1,19), conv, 'deprecated \\octave; can\'t convert automatically')) @@ -111,14 +125,11 @@ if 1: # need new a namespace if 1: # need new a namespace def conv (lines): - newlines = [] - for x in lines: - x = re.sub ('\\\\textstyle([^;]+);', - '\\\\property Lyrics . textstyle = \\1', x) - x = re.sub ('\\\\key([^;]+);', '\\\\accidentals \\1;', x) - newlines.append (x) - return newlines - + x = re.sub ('\\\\textstyle([^;]+);', + '\\\\property Lyrics . textstyle = \\1', str) + x = re.sub ('\\\\key([^;]+);', '\\\\accidentals \\1;', str) + + return str conversions.append ( ((0,1,20), conv, 'deprecated \\textstyle, new \key syntax')) @@ -126,15 +137,10 @@ if 1: # need new a namespace if 1: def conv (lines): - newlines = [] - for x in lines: - x = re.sub ('\\\\musical_pitch', - '\\\\musicalpitch',x) - x = re.sub ('\\\\meter', - '\\\\time',x) - newlines.append (x) - return newlines - + x = re.sub ('\\\\musical_pitch', '\\\\musicalpitch',str) + x = re.sub ('\\\\meter', '\\\\time',str) + + return str conversions.append ( ((0,1,21), conv, '\\musical_pitch -> \\musicalpitch, '+ @@ -150,17 +156,11 @@ if 1: if 1: def conv (lines): - newlines = [] - for x in lines: - x = re.sub ('\\\\accidentals', - '\\\\keysignature',x) - x = re.sub ('specialaccidentals *= *1', - 'keyoctaviation = 0',x) - x = re.sub ('specialaccidentals *= *0', - 'keyoctaviation = 1',x) - newlines.append (x) - return newlines - + x = re.sub ('\\\\accidentals', '\\\\keysignature',str) + x = re.sub ('specialaccidentals *= *1', 'keyoctaviation = 0',str) + x = re.sub ('specialaccidentals *= *0', 'keyoctaviation = 1',str) + + return str conversions.append ( ((1,0,1), conv, '\\accidentals -> \\keysignature, ' + @@ -168,12 +168,7 @@ if 1: if 1: def conv(lines): - found = 0 - for x in lines: - if re.search ('\\\\header', x): - found = 1 - break - if found: + if re.search ('\\\\header', lines): sys.stderr.write ('\nNot smart enough to convert to new \\header format') return lines @@ -181,76 +176,58 @@ if 1: if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\melodic', '\\\\notes',x) - newlines.append (x) - return newlines + x = re.sub ('\\\\melodic', '\\\\notes',str) + + return str conversions.append ((1,0,3), conv, '\\melodic -> \\notes') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('default_paper *=', '',x) - x = re.sub ('default_midi *=', '',x) - newlines.append (x) - return newlines + x = re.sub ('default_paper *=', '',str) + x = re.sub ('default_midi *=', '',x) + + return str conversions.append ((1,0,4), conv, 'default_{paper,midi}') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('ChoireStaff', 'ChoirStaff',x) - x = re.sub ('\\output', 'output = ',x) - newlines.append (x) - return newlines + x = re.sub ('ChoireStaff', 'ChoirStaff',str) + x = re.sub ('\\output', 'output = ',str) + + return str conversions.append ((1,0,5), conv, 'ChoireStaff -> ChoirStaff') if 1: def conv(lines): - newlines =[] - found = None - for x in lines: - found = re.search ('[a-zA-Z]+ = *\\translator',x) - newlines.append (x) - if found: break - if found: - sys.stderr.write ('\nNot smart enough to \\translator syntax') + if re.search ('[a-zA-Z]+ = *\\translator',str): + sys.stderr.write ('\nNot smart enough to change \\translator syntax') raise FatalConversionError() - return newlines + return str conversions.append ((1,0,6), conv, 'foo = \\translator {\\type .. } ->\\translator {\\type ..; foo; }') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\lyric', '\\\\lyrics',x) - newlines.append (x) - return newlines + x = re.sub ('\\\\lyric', '\\\\lyrics',str) + + return str conversions.append ((1,0,7), conv, '\\lyric -> \\lyrics') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\\\[/3+', '\\\\times 2/3 { ',x) - x = re.sub ('\\[/3+', '\\\\times 2/3 { [',x) - x = re.sub ('\\\\\\[([0-9/]+)', '\\\\times \\1 {',x) - x = re.sub ('\\[([0-9/]+)', '\\\\times \\1 { [',x) - x = re.sub ('\\\\\\]([0-9/]+)', '}', x) - x = re.sub ('\\\\\\]', '}',x) - x = re.sub ('\\]([0-9/]+)', '] }', x) - - newlines.append (x) - return newlines + x = re.sub ('\\\\\\[/3+', '\\\\times 2/3 { ',str) + x = re.sub ('\\[/3+', '\\\\times 2/3 { [',str) + x = re.sub ('\\\\\\[([0-9/]+)', '\\\\times \\1 {',str) + x = re.sub ('\\[([0-9/]+)', '\\\\times \\1 { [',str) + x = re.sub ('\\\\\\]([0-9/]+)', '}', str) + x = re.sub ('\\\\\\]', '}',str) + x = re.sub ('\\]([0-9/]+)', '] }', str) + return str conversions.append ((1,0,10), conv, '[2/3 ]1/1 -> \\times 2/3 ') @@ -262,63 +239,51 @@ if 1: if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('<([^>~]+)~([^>]*)>','<\\1 \\2> ~', x) - newlines.append (x) - return newlines + + + x = re.sub ('<([^>~]+)~([^>]*)>','<\\1 \\2> ~', str) + + return str conversions.append ((1,0,13), conv, ' c -> ~ c') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('<\\[','[<', x) - x = re.sub ('\\]>','>]', x) - newlines.append (x) - return newlines + x = re.sub ('<\\[','[<', str) + x = re.sub ('\\]>','>]', str) + + return str conversions.append ((1,0,14), conv, '<[a b> c -> [ ]') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\type','\\\\context', x) - x = re.sub ('textstyle','textStyle', x) - newlines.append (x) - return newlines + x = re.sub ('\\\\type','\\\\context', str) + x = re.sub ('textstyle','textStyle', str) + + return str conversions.append ((1,0,16), conv, '\\type -> \\context, textstyle -> textStyle') if 1: def conv(lines): - newlines =[] - found = None - for x in lines: - found = re.search ('\\\\repeat',x) - newlines.append (x) - if found: break - if found: + if re.search ('\\\\repeat',str): sys.stderr.write ('\nNot smart enough to convert \\repeat') raise FatalConversionError() - return newlines + return str conversions.append ((1,0,18), conv, '\\repeat NUM Music Alternative -> \\repeat FOLDSTR Music Alternative') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('SkipBars','skipBars', x) - x = re.sub ('fontsize','fontSize', x) - x = re.sub ('midi_instrument','midiInstrument', x) - newlines.append (x) - return newlines + x = re.sub ('SkipBars','skipBars', str) + x = re.sub ('fontsize','fontSize', str) + x = re.sub ('midi_instrument','midiInstrument', x) + + return str conversions.append ((1,0,19), conv, 'fontsize -> fontSize, midi_instrument -> midiInstrument, SkipBars -> skipBars') @@ -326,13 +291,11 @@ if 1: if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('tieydirection','tieVerticalDirection', x) - x = re.sub ('slurydirection','slurVerticalDirection', x) - x = re.sub ('ydirection','verticalDirection', x) - newlines.append (x) - return newlines + x = re.sub ('tieydirection','tieVerticalDirection', str) + x = re.sub ('slurydirection','slurVerticalDirection', str) + x = re.sub ('ydirection','verticalDirection', x) + + return str conversions.append ((1,0,20), conv, '{,tie,slur}ydirection -> {v,tieV,slurV}erticalDirection') @@ -340,11 +303,9 @@ if 1: if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('hshift','horizontalNoteShift', x) - newlines.append (x) - return newlines + x = re.sub ('hshift','horizontalNoteShift', str) + + return str conversions.append ((1,0,21), conv, 'hshift -> horizontalNoteShift') @@ -352,11 +313,9 @@ if 1: if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\grouping[^;]*;','', x) - newlines.append (x) - return newlines + x = re.sub ('\\\\grouping[^;]*;','', str) + + return str conversions.append ((1,1,52), conv, 'deprecate \\grouping') @@ -364,34 +323,28 @@ if 1: if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\wheel','\\\\coda', x) - newlines.append (x) - return newlines + x = re.sub ('\\\\wheel','\\\\coda', str) + + return str conversions.append ((1,1,55), conv, '\\wheel -> \\coda') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('keyoctaviation','keyOctaviation', x) - x = re.sub ('slurdash','slurDash', x) - newlines.append (x) - return newlines + x = re.sub ('keyoctaviation','keyOctaviation', str) + x = re.sub ('slurdash','slurDash', str) + + return str conversions.append ((1,1,65), conv, 'slurdash -> slurDash, keyoctaviation -> keyOctaviation') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\repeat *\"?semi\"?','\\\\repeat "volta"', x) - newlines.append (x) - return newlines + x = re.sub ('\\\\repeat *\"?semi\"?','\\\\repeat "volta"', str) + + return str conversions.append ((1,1,66), conv, 'semi -> volta') @@ -399,33 +352,27 @@ if 1: if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\"?beamAuto\"? *= *\"?0?\"?','noAutoBeaming = "1"', x) - newlines.append (x) - return newlines + x = re.sub ('\"?beamAuto\"? *= *\"?0?\"?','noAutoBeaming = "1"', str) + + return str conversions.append ((1,1,67), conv, 'beamAuto -> noAutoBeaming') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('automaticMelismas', 'automaticMelismata', x) - newlines.append (x) - return newlines + x = re.sub ('automaticMelismas', 'automaticMelismata', str) + + return str conversions.append ((1,2,0), conv, 'automaticMelismas -> automaticMelismata') if 1: def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('dynamicDir', 'dynamicDirection', x) - newlines.append (x) - return newlines + x = re.sub ('dynamicDir', 'dynamicDirection', str) + + return str conversions.append ((1,2,1), conv, 'dynamicDir -> dynamicDirection') @@ -447,22 +394,26 @@ def do_conversion (infile, from_version, outfile, to_version): conv_list = get_conversions (from_version, to_version) sys.stderr.write ('Applying conversions: ') - lines = infile.readlines(); + str = infile.read (-1) last_conversion = () try: for x in conv_list: sys.stderr.write (tup_to_str (x[0]) + ', ') - lines = x[1] (lines) + str = x[1] (str) last_conversion = x[0] - except FatalConversionError: sys.stderr.write ('Error while converting; I won\'t convert any further') - for x in lines: - if last_conversion: - x = re.sub (mudela_version_re_str, '\\\\version \"%s\"' % tup_to_str (last_conversion), x) - outfile.write(x) + if last_conversion: + sys.stderr.write ('\n') + new_ver = '\\\\version \"%s\"' % tup_to_str (last_conversion) + if re.search (mudela_version_re_str): + str = re.sub (mudela_version_re_str,new_ver , str) + else: + str = new_ver + '\n' + str + + outfile.write(str) class UnknownVersion: pass @@ -524,15 +475,17 @@ to_version = () from_version = () outfile_name = '' -identify () (options, files) = getopt.getopt ( - sys.argv[1:], 'o:f:t:seh', ['output', 'show-rules', 'help', 'edit', 'from', 'to']) + sys.argv[1:], 'o:f:t:seh', ['version', 'output', 'show-rules', 'help', 'edit', 'from=', 'to']) for opt in options: o = opt[0] a = opt[1] if o== '--help' or o == '-h': help () + if o == '--version' or o == '-v': + print_version () + sys.exit (0) elif o== '--from' or o=='-f': from_version = str_to_tuple (a) elif o== '--to' or o=='-t': @@ -548,7 +501,7 @@ for opt in options: print o raise getopt.error - +identify () for f in files: if f == '-': f = '' diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 64afbc5c4d..b2d62ef9db 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -353,6 +353,10 @@ class TeXOutput: + +# ARG! THIS CODE IS BLOATED: +# FIXME: Junk all set/get methods. + class Properties: """ This class handles all ly2dvi.py property manipulation diff --git a/scripts/mudela-book.py b/scripts/mudela-book.py index 59c1ad287b..0000a26aea 100644 --- a/scripts/mudela-book.py +++ b/scripts/mudela-book.py @@ -1,77 +1,4 @@ #!@PYTHON@ -# -# The bugs you find are made by Tom Cato Amundsen -# Send patches/questions/bugreports to a mailinglist: -# gnu-music-discuss@gnu.org -# bug-gnu-music@gnu.org -# help-gnu-music@gnu.org -# -# TODO: -# * center option (??) -# * make mudela-book understand usepackage{geometry} -# * check that linewidth set in \paper is not wider than actual linewidth? -# * the following fails because mudelabook doesn't care that the -# last } after \end{mudela} finishes the marginpar: -# \marginpar{ -# \begin{mudela} -# c d e f g -# \end{mudela}} -# * force-verbatim is maybe not that useful since latex fails with footnotes, -# marginpars and others -# log: -# 0.3: -# rewrite in Python. -# 0.4: -# much rewritten by new author. I think the work has been split more -# logical between different classes. -# 0.4.1: -# - cleanup -# - speedup, do all mudela parsing at the same time to avoid multiple -# guile startup that takes some seconds on my computer -# 0.4.2: -# - fixed default latex fontsize, it should be 10pt not 11pt -# - verbatim option no longer visible -# - mudela-book produces .dvi output -# - change to use castingalgorithm = \Gourlay instead of \Wordwrap. It gives -# better result on small linewidths. -# - mudela-book-doc.doc rewritten -# 0.5: -# - junked floating and fragment options, added eps option -# - mudela-book will scan the mudela code to find out if it has to add -# paper-definition and \score{\notes{...}} -# - possible to define commands that look like this: \mudela{ c d e } -# - don't produce .dvi output, it was a silly idea... -# 0.5.1: -# - removed init/mudela-book-defs.py, \mudela is defined inside mudela-book -# - fragment and nonfragment options will override autodetection of type of -# in mudela-block (voice contents or complete code) -# 0.5.2: -# - fixed verbatim option behaviour: don't show \begin{mudela} \end{mudela} -# and show both mudela code and music -# - veryverbatim option, same as verbatim but show \begin{mudela} -# and \end{mudela}. (saves keystrokes in mudela-book-doc.doc) -# - intertext="bla bla bla" option -# - mudela-book now understand latex \begin{verbatim} -# 0.5.3: -# - bf: \mudela{ \times 2/3{...} } -# * \t in \times is not tab character and -# * dont treat the first '}' as command ending -# 0.5.4: (Mats B) -# - .fly and .sly files in \mudelafile{} are treated as standalone Lilypond. -# - Fragments, .fly and .sly files are in \relative mode. -# 0.5.5: (Mats B) -# - bf: Default fragments have linewidth=-1.0 -# - Added 'singleline' and 'multiline' options. -# 0.5.6: -# - \mudelafile{} set linewidth correct, -1 for .sly and texlinewidth for .fly -# - changes to Mudela_output -# - changed RE to search for pre/postMudelaExample to make it possible to -# comment out a definition. -# - use sys.stderr and sys.stdout instead of print -# 1.1.62 -# - junked separate versioning -# - pass -I options to lily. -# - portability stuff (os.sep). import os import string @@ -83,739 +10,722 @@ import __main__ outdir = 'out' initfile = '' program_version = '@TOPLEVEL_VERSION@' -include_path = ['.'] - -out_files = [] - -fontsize_i2a = {11:'eleven', 13:'thirteen', 16:'sixteen', - 20:'twenty', 26:'twentysix'} -fontsize_pt2i = {'11pt':11, '13pt':13, '16pt':16, '20pt':20, '26pt':26} - -# perhaps we can do without this? - -begin_mudela_re = re.compile ('^ *\\\\begin{mudela}') -begin_verbatim_re = re.compile ('^ *\\\\begin{verbatim}') -end_verbatim_re = re.compile ('^ *\\\\end{verbatim}') -extract_papersize_re = re.compile('\\\\documentclass[\[, ]*(\w*)paper[\w ,]*\]\{\w*\}') -extract_fontsize_re = re.compile('[ ,\[]*([0-9]*)pt') -begin_mudela_opts_re = re.compile('\[[^\]]*\]') -end_mudela_re = re.compile ('^ *\\\\end{mudela}') -section_re = re.compile ('\\\\section') -chapter_re = re.compile ('\\\\chapter') -input_re = re.compile ('^\\\\input{([^}]*)') -include_re = re.compile ('^\\\\include{([^}]*)') -begin_document_re = re.compile ('^ *\\\\begin{document}') -documentclass_re = re.compile('\\\\documentclass') -twocolumn_re = re.compile('\\\\twocolumn') -onecolumn_re = re.compile('\\\\onecolumn') -mudela_file_re = re.compile('\\\\mudelafile{([^}]+)}') -file_ext_re = re.compile('.+\\.([^.}]+$)') -preMudelaExample_re = re.compile('^\s*\\\\def\\\\preMudelaExample') -postMudelaExample_re = re.compile('^\s*\\\\def\\\\postMudelaExample') -boundingBox_re = re.compile('%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)') -intertext_re = re.compile("intertext=\"([^\"]*)\"") - -def file_exist_b(name): - try: - f = open(name) - except IOError: - return 0 - f.close () - return 1 - -def ps_dimention(fname): - fd = open(fname) - lines = fd.readlines() - for line in lines: - s = boundingBox_re.search(line) - if s: - break - return (int(s.groups()[2])-int(s.groups()[0]), - int(s.groups()[3])-int(s.groups()[1])) +cwd = os.getcwd () +include_path = [cwd] -def find_file (name): - for a in include_path: +# TODO: use splitting iso. \mudelagraphic. + +# +default_music_fontsize = 16 +default_text_fontsize = 12 + +# latex linewidths: +# indices are no. of columns, papersize, fontsize +# Why can't this be calculated? +latex_linewidths = { + 1: {'a4':{10: 345, 11: 360, 12: 390}, + 'a5':{10: 276, 11: 276, 12: 276}, + 'b5':{10: 345, 11: 356, 12: 356}, + 'letter':{10: 345, 11: 360, 12: 390}, + 'legal': {10: 345, 11: 360, 12: 390}, + 'executive':{10: 345, 11: 360, 12: 379}}, + 2: {'a4':{10: 167, 11: 175, 12: 190}, + 'a5':{10: 133, 11: 133, 12: 133}, + 'b5':{10: 167, 11: 173, 12: 173}, + 'letter':{10: 167, 11: 175, 12: 190}, + 'legal':{10: 167, 11: 175, 12: 190}, + 'executive':{10: 167, 11: 175, 12: 184}}} + + +options = [ + ('', 'h', 'help', 'print help'), + ('EXT', 'f', 'format', 'set format. EXT is one of texi and latex.'), + ('', 'v', 'version', 'print version information' ), + ('FILE', 'o', 'outname', 'prefix for filenames'), + ('DIM', '', 'default-mudela-fontsize', 'default fontsize for music. DIM is assumed to in points'), +# ('DIM', '', 'force-mudela-fontsize', 'force fontsize for all inline mudela. DIM is assumed to in points'), + ('', '', 'force-verbatim', 'make all mudela verbatim'), + ('', 'M', 'dependencies', 'write dependencies'), + ('DIR', 'I', 'include', 'include path'), + ('', '', 'init', 'mudela-book initfile') + ] + +format = 'latex' +no_match = 'a\ba' + +# format specific strings, ie. regex-es for input, and % strings for output +re_dict = { + 'latex': {'input': '\\\\input{?([^}\t \n}]*)', + 'include': '\\\\include{([^}]+)}', + 'include-mudela':r"""\begin%s{mudela} +%s +\end{mudela}""", + 'header': r"""\\documentclass(\[.*?\])?""", + 'preamble-end': '\\\\begin{document}', + 'verbatim': r"""(?s)\\begin{verbatim}(.*?)\\end{verbatim}""", + 'verb': r"""\\verb(.)(.*?)\1""", + 'mudela-file': '\\\\mudelafile(\[[^\\]]+\])?{([^}]+)}', + 'mudela' : '\\\\mudela(\[.*?\])?{(.*?)}', + 'mudela-block': r"""(?s)\\begin(\[.*?\])?{mudela}(.*?)\\end{mudela}""", + 'interesting-cs': '\\\\(chapter|section|mudelagraphic|twocolumn|onecolumn)', + 'quote-verbatim': r"""\begin{verbatim}%s\end{verbatim}""", + 'def-post-re': r"""\\def\\postMudelaExample""", + 'def-pre-re': r"""\\def\\preMudelaExample""", + 'default-post': r"""\def\postMudelaExample{}""", + 'default-pre': r"""\def\preMudelaExample{}""", + 'output-eps': '\\noindent\\parbox{\\mudelaepswidth{%s.eps}}{\includegraphics{%s.eps}}', + 'output-tex': '\\preMudelaExample \\input %s.tex \\postMudelaExample\n' + }, + 'texi': {'input': '@include[ \n\t]+([^\t \n]*)', + 'include': no_match, + 'include-mudela': """@mudela[%s] +%s +@end mudela +""", + 'header': no_match, + 'preamble-end': no_match, + 'verbatim': r"""(?s)@example(.*?)@end example$""", + 'verb': r"""@code{(.*?)}""", + 'mudela-file': '@mudelafile(\[[^\\]]+\])?{([^}]+)}', + 'mudela' : '@mudela(\[.*?\])?{(.*?)}', + 'mudela-block': r"""(?s)@mudela(\[.*?\])?(.*?)@end mudela""", + 'interesting-cs': r"""[\\@](node|mudelagraphic)""", + 'quote-verbatim': r"""@example +%s +@end example""", + 'output-all': r"""@tex +\input %s.tex +@end tex +@html + +@end html +""", + } + } + + + + +def get_re (name): + return re_dict[format][name] + + +def bounding_box_dimensions(fname): try: - nm = os.path.join (a, name) - f = open (nm) - return nm + fd = open(fname) except IOError: - pass - return '' + error ("Error opening `%s'" % fname) + str = fd.read (-1) + s = re.search('%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)', str) + if s: + return (int(s.group(3))-int(s.group(1)), + int(s.group(4))-int(s.group(2))) + else: + return (0,0) + +def find_file (name): + for a in include_path: + try: + nm = os.path.join (a, name) + f = open (nm) + return nm + except IOError: + pass + return '' + +def error (str): + sys.stderr.write (str + "\n Exiting ... \n\n") + raise 'Exiting.' + + +def compose_full_body (body, opts): + "Construct the text of an input file: add stuff to BODY using OPTS as options." + paper = 'a4' + music_size = default_music_fontsize + latex_size = default_text_fontsize + + cols = 1 + for o in opts: + m = re.search ('^(.*)paper$', o) + if m: + paper = m.group (1) + + + m = re.match ('([0-9]+)pt', o) + if m: + music_size = string.atoi(m.group (1)) -class CompileStatus: - pass -class SomethingIsSeriouslyBroken: - pass + m = re.match ('latexfontsize=([0-9]+)pt', o) + if m: + latex_size = string.atoi (m.group (1)) + + + if 'twocolumn' in opts: + cols = 2 + + if 'fragment' or 'singleline' in opts: + l = -1.0; + else: + l = latex_linewidths[cols][paper][latex_size] -def file_mtime (name): - return os.stat (name)[8] #mod time + if not 'nofly' in opts and not re.search ('\\\\score', body): + opts.append ('fly') + + + if 'fly' in opts: + body = r"""\score { + \notes\relative c { + %s + } + \paper { } +}""" % body + + + body = r""" +%% Generated by mudela-book.py +\include "paper%d.ly" +\paper { linewidth = %f \pt; } +""" % (music_size, l) + body + + return body -def need_recompile_b(infile, outfile): - indate = file_mtime (infile) - try: - outdate = file_mtime (outfile) - return indate > outdate - except os.error: - return 1 # -# executes os.system(command) if infile is newer than -# outfile or outfile don't exist +# Petr, ik zou willen dat ik iets zinvoller deed, +# maar wat ik kan ik doen, het verandert toch niets? +# --hwn 20/aug/99 # -def compile (command, workingdir, infile, outfile): - "Test if infile is newer than outfile. If so, cd to workingdir" - "and execute command" - print "COMPILE!!" - indate = file_mtime (workingdir+infile) - try: - outdate = file_mtime (workingdir+outfile) - recompile = indate > outdate - - except os.error: - recompile = 1 - - if recompile: - sys.stderr.write ('invoking `%s\'\n' % command) - if workingdir == '': - status = os.system (command) - else: - status = os.system ('cd %s; %s' %(workingdir, command)) - if status: - raise CompileStatus - -class Properties: - # - # init - # - def __init__(self): - self.__linewidth = { - 1: {'a4':{10: 345, 11: 360, 12: 390}, - 'a5':{10: 276, 11: 276, 12: 276}, - 'b5':{10: 345, 11: 356, 12: 356}, - 'letter':{10: 345, 11: 360, 12: 390}, - 'legal': {10: 345, 11: 360, 12: 390}, - 'executive':{10: 345, 11: 360, 12: 379}}, - 2: {'a4':{10: 167, 11: 175, 12: 190}, - 'a5':{10: 133, 11: 133, 12: 133}, - 'b5':{10: 167, 11: 173, 12: 173}, - 'letter':{10: 167, 11: 175, 12: 190}, - 'legal':{10: 167, 11: 175, 12: 190}, - 'executive':{10: 167, 11: 175, 12: 184}}} - # >0 --> force all mudela to this pt size - self.force_mudela_fontsize = 0 - self.force_verbatim_b = 0 - self.__data = { - 'mudela-fontsize' : {'init': 16}, - 'papersize' : {'init': 'a4'}, - 'num-column' : {'init': 1}, - 'tex-fontsize' : {'init': 10} - } - def clear_for_new_file(self): - for var in self.__data.keys(): - self.__data[var] = {'init': self.__data[var]['init']} - def clear_for_new_block(self): - for var in self.__data.keys(): - if self.__data[var].has_key('block'): - del self.__data[var]['block'] - def __get_variable(self, var): - if self.__data[var].has_key('block'): - return self.__data[var]['block'] - elif self.__data[var].has_key('file'): - return self.__data[var]['file'] - else: - return self.__data[var]['init'] - def setPapersize(self, size, requester): - self.__data['papersize'][requester] = size - def getPapersize(self): - return self.__get_variable('papersize') - def setMudelaFontsize(self, size, requester): - self.__data['mudela-fontsize'][requester] = size - def getMudelaFontsize(self): - if self.force_mudela_fontsize: - return self.force_mudela_fontsize - return self.__get_variable('mudela-fontsize') - def setTexFontsize(self, size, requester): - self.__data['tex-fontsize'][requester] = size - def getTexFontsize(self): - return self.__get_variable('tex-fontsize') - def setNumColumn(self, num, requester): - self.__data['num-column'][requester] = num - def getNumColumn(self): - return self.__get_variable('num-column') - def getLineWidth(self): - return self.__linewidth[self.getNumColumn()][self.getPapersize()][self.getTexFontsize()] - - -class Mudela_output: - """ Using only self.code_type to deside both value of linewith and - if we have to put code into \score{...} was silly. Now we use: - self.code_type: show us what need to be added. - None : init value - 'NOTES' : add \context Voice{ ... } - 'CONTEXT' : add \score{ ... } - 'COMPLETE' : jupp - self.single_line_b: 0 : linewidth=-1 1: linewith=textwidth - """ - def __init__ (self, basename): - self.basename = basename - self.temp_filename = "%s/%s" %(outdir, 'mudela-temp.ly') - self.file = open (self.temp_filename, 'w') - self.__lines = [] - # 'tex' or 'eps' - self.graphic_type = 'tex' - self.code_type = None - self.single_line_b = 1 - self.optlist = [] - def write (self, line): - # match only if there is nothing but whitespace before \begin. - # we should not have to do this RE for every line - if re.search('^\s*\\\\begin{mudela}', line): - r = begin_mudela_opts_re.search(line) - if r: - o = r.group()[1:-1] - self.optlist = re.compile('[\s,]*').split(o) - else: - self.optlist = [] - else: # ugh this is NOT bulletproof... - if not self.code_type: - if re.search('^\s*%', line) or re.search('^\s*$', line): - pass - elif re.search('^\s*\\\\context', line): - self.code_type = 'CONTEXT' - self.single_line_b = 0 - elif re.search('^\s*\\\\score', line) or \ - re.search('^\s*\\\\paper', line) or \ - re.search('^\s*\\\\header', line) or \ - re.search('^\s*\\\\version', line) or \ - re.search('^\s*\\\\include', line) or \ - re.search('^\s*[A-Za-z]*\s*=', line): - self.code_type = 'COMPLETE' - self.single_line_b = 0 - else: - self.code_type = 'NOTES' - self.single_line_b = 1 - self.__lines.append(line) - def write_red_tape(self): - if 'eps' in self.optlist: - self.graphic_type = 'eps' - #self.single_line_b = 1 - if 'fragment' in self.optlist: - self.code_type = 'NOTES' - if 'nonfragment' in self.optlist: - self.code_type = 'COMPLETE' - if 'multiline' in self.optlist: - self.single_line_b = 0 - for pt in fontsize_pt2i.keys(): - if pt in self.optlist: - Props.setMudelaFontsize(fontsize_pt2i[pt], 'block') - self.file.write ('\\include \"paper%d.ly\"\n' \ - % Props.getMudelaFontsize()) - - s = fontsize_i2a[Props.getMudelaFontsize()] - if 'singleline' in self.optlist: - self.single_line_b = 1 - if self.single_line_b: - linewidth_str = 'linewidth = -1.\cm;' - else: - linewidth_str = 'linewidth = %i.\\pt;' % Props.getLineWidth() - self.file.write("\\paper {" - + "\\paper_%s " % s - + linewidth_str - + "castingalgorithm = \Gourlay; \n}\n") - #+ "castingalgorithm = \Wordwrap; indent = 2.\cm; \n}") - if self.code_type == 'CONTEXT': - self.file.write('\\score{\n\\notes\\relative c{') - if self.code_type == 'NOTES' : - self.file.write('\\score{\n\\notes\\relative c{\\context Voice{') - def close (self): - self.write_red_tape() - for l in self.__lines: - self.file.write(l) - if self.code_type == 'CONTEXT': - self.file.write('}}') - elif self.code_type == 'NOTES': - self.file.write('}}}') - self.file.close() - - inf = outdir + self.basename + '.ly' - outf = outdir + self.basename + '.tex' - if not os.path.isfile(inf): - status = 1 - else: - status = os.system ('diff -q %s %s' % (self.temp_filename, inf)) - if status: - os.rename (self.temp_filename, inf) - - recompile_b = need_recompile_b(inf, outf) - if recompile_b: - out_files.append((self.graphic_type, inf)) - return recompile_b - - def insert_me_string(self): - "ugh the name of this function is wrong" - if self.graphic_type == 'tex': - return ['tex', self.basename] - elif self.graphic_type == 'eps': - return ['eps', self.basename] - else: - raise SomethingIsSeriouslyBroken - -class Tex_output: - def __init__ (self, name): - self.output_fn = '%s/%s' % (outdir, name) - self.__lines = [] - def open_verbatim (self, line, level): - self.__lines.append('\\begin{verbatim}\n') - if level == 2: - s = re.sub('veryverbatim[\s,]*', '', line) - s = re.sub('intertext=\"([^\"]*)\"[\s,]*', '', s) - s = re.sub(',\s*\]', ']', s) - s = re.sub('\[\]', '', s) - self.__lines.append(s); - def close_verbatim (self): - self.__lines.append('\\end{verbatim}\n') - def write (self, s): - self.__lines.append(s) - def create_graphics(self): - s = '' - g_vec = [] - for line in self.__lines: - if type(line)==type([]): - g_vec.append(line) - for g in g_vec: - if need_recompile_b(outdir+g[1]+'.ly', outdir+g[1]+'.tex'): - s = s + ' ' + g[1]+'.ly' - - lilyoptions = '' - for inc in __main__.include_path : - p = inc[:] - if p[0] <> os.sep and outdir: # UGH-> win32 ? - p = '..' + os.sep + p - lilyoptions = lilyoptions + " -I \"%s\"" % p + + +def read_tex_file (filename): + """Read the input file, substituting for \input, \include, \mudela{} and \mudelafile""" + str = '' + for fn in [filename, filename+'.tex', filename+'.doc']: + try: + f = open(fn) + str = f.read (-1) + except: + pass - if s != '': - cmd = 'cd %s; lilypond %s %s' %(outdir, lilyoptions, s) - sys.stderr.write ('invoking command %s' % cmd) - e = os.system(cmd) - if e: - sys.stderr.write("error: lilypond exited with value %i\n" % e) - sys.exit(e) - for g in g_vec: - if g[0] == 'eps': - compile('tex %s' % g[1]+'.tex', outdir, g[1]+'.tex', g[1]+'.dvi') - compile('dvips -E -o %s %s' %(g[1]+'.eps', g[1]+'.dvi'), outdir, - g[1]+'.dvi', g[1]+'.eps') - def write_outfile(self): - file = open(self.output_fn+'.latex', 'w') - file.write('% Created by mudela-book\n') - last_line = None - for line in self.__lines: - if type(line)==type([]): - if last_line == '\n': - file.write(r'\vspace{0.5cm}') - if line[0] == 'tex': - file.write('\\preMudelaExample \\input %s \\postMudelaExample\n'\ - % (line[1]+'.tex')) - if line[0] == 'eps': - ps_dim = ps_dimention(outdir+line[1]+'.eps') - file.write('\\noindent\\parbox{%ipt}{\includegraphics{%s}}\n' \ - % (ps_dim[0], line[1]+'.eps')) - else: - file.write(line) - if type(last_line)==type([]): - if line=='\n': - file.write(r'\vspace{0.5cm}') - last_line = line - file.close() - -# given parameter s="\mudela[some options]{CODE} some text and commands" -# it returns a tuple: -# (CODE, integer) -# where the last number is the index of the ending '}' -def extract_command(s): - start_found_b = 0 - count = 0 - start = 0 - for idx in range(len(s)): - if s[idx] == '{': - if not start_found_b: - start = idx - start_found_b = 1 - count = count + 1 - if s[idx] == '}': - count = count - 1 - if (start_found_b == 1) and (count == 0): - break - return s[start+1:idx], idx - -class Tex_input: - def __init__ (self, filename): - for fn in [filename, filename+'.tex', filename+'.doc']: - try: - self.infile = open (fn) - self.filename = fn - return - except: - continue - raise IOError - - def get_lines (self): - lines = self.infile.readlines () - (retlines, retdeps) = ([],[self.filename]) - for line in lines: - r_inp = input_re.search (line) - r_inc = include_re.search (line) - - # Filename rules for \input : - # input: no .tex ext - # 1. will search for file with exact that name (tex-input.my will be found) - # 2. will search for file with .tex ext, (tex-input.my - # will find tex-input.my.tex) - # input: with .tex ext - # 1. will find exact match - - # Filename rules for \include : - # 1. will only find files with name given to \include + .tex ext - if r_inp: - try: - t = Tex_input (r_inp.groups()[0]) - ls = t.get_lines () - retlines = retlines + ls[0] - retdeps = retdeps + ls[1] - except: - sys.stderr.write("warning: can't find %s, let's hope latex will\n" % r_inp.groups()[0]) - retlines.append (line) - elif r_inc: - try: - t = Tex_input (r_inc.groups()[0]+'.tex') - ls =t.get_lines () - ls[0].insert(0, '\\newpage\n') - ls[0].append('\\newpage\n') - retlines = retlines + ls[0] - retdeps = retdeps + ls[1] - except: - sys.stderr.write("warning: can't find %s, let's hope latex will" % r_inc.groups()[0]) - retlines.append (line) - else: - # This code should be rewritten, it looks terrible - r_mud = defined_mudela_cmd_re.search(line) - if r_mud: - # TODO document this - ss = "\\\\verb(?P[^a-zA-Z])\s*\\\\%s\s*(?P=xx)" \ - % re.escape(r_mud.group()[1:]) - # just append the line if the command is inside \verb|..| - if re.search(ss, line): - retlines.append(line) - continue - while 1: - opts = r_mud.groups()[2] - cmd_start_idx = r_mud.span()[0] - if cmd_start_idx > 0: - retlines.append(line[:cmd_start_idx]) - - cmd_data, rest_idx = extract_command(line[cmd_start_idx:]) - rest_idx = rest_idx + cmd_start_idx + 1 - if opts == None: - opts = '' - else: - opts = ', '+opts - - v = string.split(defined_mudela_cmd[r_mud.groups()[0]], '\n') - for l in v[1:-1]: - l = string.replace(l, '\\fontoptions', opts) - l = string.replace(l, '\\maininput', cmd_data) - retlines.append(l) - r_mud = defined_mudela_cmd_re.search(line[rest_idx:]) - if not r_mud: - rs = line[rest_idx:] - while rs[0] == " ": - rs = rs[1:] - if rs != "\n": - retlines.append(line[rest_idx:]) - break; - line = line[rest_idx:] - else: - retlines.append (line) - return (retlines, retdeps) - - -class Main_tex_input(Tex_input): - def __init__ (self, name, outname): - - Tex_input.__init__ (self, name) # ugh - self.outname = outname - self.chapter = 0 - self.section = 0 - self.fine_count =0 - self.mudtex = Tex_output (self.outname) - self.mudela = None - self.deps = [] - self.verbatim = 0 - # set to 'mudela' when we are processing mudela code, - # both verbatim and graphic-to-be - self.mode = 'latex' - def set_sections (self, l): - if section_re.search (l): - self.section = self.section + 1 - if chapter_re.search (l): - self.section = 0 - self.chapter = self.chapter + 1 - - def gen_basename (self): - return '%s-%d.%d.%d' % (self.outname, self.chapter, - self.section, self.fine_count) - def extract_papersize_from_documentclass(self, line): - pre = extract_papersize_re.search(line) - if not pre: - return None - return pre.groups()[0] - def extract_fontsize_from_documentclass(self, line): - r = extract_fontsize_re.search(line) - if r: - return int(r.groups()[0]) - def do_it(self): - preMudelaDef = postMudelaDef = 0 - (lines, self.deps) = self.get_lines () - #HACK - latex_verbatim = 0 - for line in lines: - if documentclass_re.search (line): - p = self.extract_papersize_from_documentclass (line) - if p: - Props.setPapersize(p, 'file') - f = self.extract_fontsize_from_documentclass (line) - if f: - Props.setTexFontsize (f, 'file') - elif twocolumn_re.search (line): - Props.setNumColumn (2, 'file') - elif onecolumn_re.search (line): - Props.setNumColumn (1, 'file') - elif preMudelaExample_re.search (line): - preMudelaDef = 1 - elif postMudelaExample_re.search (line): - postMudelaDef = 1 - elif begin_verbatim_re.search (line): - latex_verbatim = 1 - elif end_verbatim_re.search (line): - latex_verbatim = 0 - elif begin_document_re.search (line): - if not preMudelaDef: - self.mudtex.write ('\\def\\preMudelaExample{}\n') - if not postMudelaDef: - self.mudtex.write ('\\def\\postMudelaExample{}\n') - - elif mudela_file_re.search(line): - r = mudela_file_re.search(line) - - self.mudela = Mudela_output(self.gen_basename()) - fn = r.group (1) - full_path = find_file (fn) + + if not str: + raise IOError + + retdeps = [filename] + + def inclusion_func (match, surround): + insert = match.group (0) + try: + (insert, d) = read_tex_file (match.group(1)) + deps = deps + d + insert = surround + insert + surround + except: + sys.stderr.write("warning: can't find %s, let's hope latex will\n" % m.group(1)) + + return (insert, deps) + + def include_func (match, d = retdeps): + (s,d) = inclusion_func (match, '\\newpage ', retdeps) + retdeps = retdeps + d + return s + + str = re.sub (get_re ('input'), include_func, str) + + def input_func (match, d = retdeps): + (s,d) = inclusion_func (match, '', retdeps) + retdeps = retdeps + d + return s + + str = re.sub (get_re ('include'), input_func, str) + + return (str, retdeps) + +def scan_preamble (str): + options = [] + m = re.search (get_re ('header'), str) + + # should extract paper & fontsz. + if m and m.group (1): + options = options + re.split (',[\n \t]*', m.group(1)[1:-1]) + + def verbose_fontsize ( x): + if o.match('[0-9]+pt'): + return 'latexfontsize=' + x + else: + return x + + options = map (verbose_fontsize, options) + + return options + + +def completize_preamble (str): + m = re.search (get_re ('preamble-end'), str) + if not m: + return str + + preamble = str [:m.start (0)] + str = str [m.start(0):] + + if not re.search (get_re('def-post-re'), preamble): + preamble = preamble + get_re('default-post') + if not re.search (get_re ('def-pre-re'), preamble): + preamble = preamble + get_re ('default-pre') + + if re.search ('\\\\includegraphics', str) and not re.search ('usepackage{graphics}',str): + preamble = preamble + '\\usepackage{graphics}\n' + + return preamble + str + +def find_mudela_sections (str): + """Find mudela blocks, while watching for verbatim. Returns + (STR,MUDS) with \mudelagraphic substituted for the blocks in STR, + and the blocks themselves MUDS""" + + mudelas = [] + verbblocks = [] + noverbblocks = [] + + while str: + m = re.search (get_re ('verbatim'), str) + m2 = re.search (get_re ("verb"), str) + + if m == None and m2 == None: + noverbblocks.append (str) + str = '' + break + + if m == None: + m = m2 + + if m2 and m2.start (0) < m.start (0): + m = m2 + + noverbblocks.append (str[:m.start (0)]) + verbblocks.append (m.group (0)) + str = str [m.end(0):] + + def mudela_short (match): + "Find \mudela{}, and substitute appropriate \begin / \end blocks." + opts = match.group (1) + if opts: + opts = ',' + opts[1:-1] + else: + opts = '' + return r"""\begin[eps,fragment%s]{mudela} + \context Staff < + \context Voice{ + %s + } + > +\end{mudela}""" % (opts, match.group (2)) + + def mudela_file (match): + "Find \mudelafile, and substitute appropriate \begin / \end blocks." + d = [] #, d = retdeps + full_path = find_file (match.group (2)) if not full_path: - sys.stderr.write("error: can't find file '%s'\n" % fn) - sys.exit (1) - - f = open (full_path, 'r') - lines =f.readlines () - self.mudela.write ('%% This is a copy of file %s\n' % full_path) - for x in lines: - self.mudela.write (x) - r = file_ext_re.search(fn) - if r: - if r.group(1) == 'fly': - self.mudela.optlist.append('multiline') - stat =self.mudela.close () - if stat: - sys.stdout.write("(File %s needs recompiling)\n" % full_path) - self.mudtex.write (self.mudela.insert_me_string()) - self.deps.append (full_path) - del self.mudela - self.mudela = None - self.fine_count = self.fine_count + 1 - continue - elif begin_mudela_re.search (line) and not latex_verbatim: - Props.clear_for_new_block() - if __debug__: - if self.mode == 'mudela': - raise AssertionError - self.mode = 'mudela' - r = begin_mudela_opts_re.search (line) - if r: - o = r.group()[1:][:-1] - optlist = re.compile('[ ,]*').split(o) - m = intertext_re.search(r.group()) - if m: - self.intertext = m.groups()[0] - else: - self.intertext = None - else: - optlist = [] - if ('veryverbatim' in optlist): - self.verbatim = 2 - elif ('verbatim' in optlist) or (Props.force_verbatim_b): - self.verbatim = 1 - else: - self.verbatim = 0 - if self.verbatim: - self.mudtex.open_verbatim (line, self.verbatim) - self.mudela = Mudela_output (self.gen_basename ()) - self.mudela.write (line) - continue - elif end_mudela_re.search (line) and not latex_verbatim: - if __debug__: - if self.mode != 'mudela': - raise AssertionError - - if self.verbatim: - if self.verbatim == 2: - self.mudtex.write (line) - self.mudtex.close_verbatim () - self.mudela.close () - if self.verbatim and self.intertext: - self.mudtex.write(self.intertext) - self.mudtex.write (self.mudela.insert_me_string()) - del self.mudela - self.mudela = None - self.fine_count = self.fine_count + 1 - self.mode = 'latex' - continue - - - if self.mode == 'mudela': - self.mudela.write (line) - if self.verbatim: - self.mudtex.write (line) - else: - self.mudtex.write (line) - self.set_sections(line) - self.mudtex.create_graphics() - self.mudtex.write_outfile() - del self.mudtex + error("error: can't find file `%s'\n" % match.group(2)) + + d.append (full_path) + f = open (full_path) + str = f.read (-1) + opts = match.group (1) + if opts: + opts = re.split (',[ \n\t]*', opts[1:-1]) + else: + opts = [] + + if re.search ('.fly$', full_path): + opts.append ('fly') + elif re.search ('.sly$', full_path): + opts = opts + [ 'fly','fragment'] + elif re.search ('.ly$', full_path): + opts .append ('nofly') + + str_opts = string.join (opts, ',') + if str_opts: str_opts = '[' + str_opts + ']' + + + str = "%% copied from %s" % full_path + str + return get_re ('include-mudela') % (str_opts, str) + + + def find_one_mudela_block (match,muds =mudelas): + "extract body and options from a mudela block, and append into MUDELAS" + opts = match.group (1) + if opts: + opts = opts[1:-1] + else: + opts = '' + + body = match.group (2) + optlist = re.split (', *', opts) + muds.append ((body, optlist)) + + return '\\mudelagraphic\n'# UGH. + + doneblocks = [] + for b in noverbblocks: + b = re.sub (get_re('mudela-file'), mudela_file, b) + b = re.sub (get_re('mudela'), mudela_short, b) + b = re.sub (get_re ("mudela-block"), find_one_mudela_block, b) + doneblocks.append (b) + + allblocks = [] + verbblocks.append ('') + while doneblocks: + allblocks = allblocks + doneblocks[0:1] + verbblocks[0:1] + verbblocks = verbblocks[1:] + doneblocks =doneblocks[1:] + + str = string.join (allblocks,'') + + return (str, mudelas) + + +def eps_file_cs (base): + if format == 'latex': + return + els + +def tex_file_cs (base): + return + + + + +def make_files (str, mudelas, filename): + (chapter, section, count) = (0,0,0) + total = 0 + done = '' + + # number them. + numbering = [] + current_opts = [] + while str: + m = re.search (get_re ('interesting-cs'), str) + if not m: + done = done + str + str = '' + break + + done = done + str[:m.end (0)] + str = str[m.end(0):] + g = m.group (1) + + if g == 'twocolumn': + current_opts.append ('twocolumn') + elif g == 'onecolumn': + try: + current_opts.remove ('twocolumn') + except IndexError: + pass + if g == 'mudelagraphic': + numbering.append ((chapter, section, count, current_opts[:])) + count = count + 1 + elif g == 'chapter': + (chapter, section, count) = (chapter + 1, 0, 0) + elif g == 'section' or g == 'node': + (section, count) = (section + 1, 0) + + + todo = [] + str = done + + + done = '' + while str: + m = re.search ('\\\\mudelagraphic', str) + if not m: + done = done + str; + str = '' + break + + done = done + str[:m.start(0)] + str = str[m.end(0):] + (c1,c2,c3, file_opts) = numbering[0] + (body, opts) = mudelas[0] + numbering = numbering[1:] + mudelas = mudelas[1:] + + opts = opts + file_opts + + base = '%s-%d.%d.%d' % (filename, c1, c2,c3) + if 'verbatim' in opts: + done = done + get_re ('quote-verbatim') % body + + + body = compose_full_body (body, opts) + updated = update_file (body, base + '.ly') + def is_updated (extension, t = todo): + for x in t: + if t[0] == extension: + return 1 + return 0 + + if not os.path.isfile (base + '.tex') or updated: + todo.append (('tex', base, opts)) + updated = 1 + + for o in opts: + m = re.search ('intertext="(.*?)"', o) + if m: + done = done + m.group (1) + + if format == 'texi': + opts.append ('png') + + if 'png' in opts: + opts.append ('eps') + + if 'eps' in opts and (is_updated ('tex') or + not os.path.isfile (base + '.eps')): + todo.append (('eps', base, opts)) + + if 'png' in opts and (is_updated ('eps') or + not os.path.isfile (base + '.png')): + todo.append (('png', base, opts)) + + if format == 'latex': + if 'eps' in opts : + done = done + get_re ('output-eps') % (base, base ) + else: + done = done + get_re ('output-tex') % base + elif format == 'texi': + done = done + get_re ('output-all') % (base, base) + + + compile_all_files (todo) + + def find_eps_dims (match): + "Fill in dimensions of EPS files." + fn =match.group (1) + dims = bounding_box_dimensions (fn) + + return '%ipt' % dims[0] + + done = re.sub (r"""\\mudelaepswidth{(.*?)}""", find_eps_dims, done) + + return done + +def system (cmd): + sys.stderr.write ("invoking `%s'\n" % cmd) + st = os.system (cmd) + if st: + sys.stderr.write ('Error command exited with value %d\n' % st) + return st + +def compile_all_files ( list): + eps = [] + tex = [] + gif = [] + for l in list: + if l[0] == 'eps': + eps.append (l[1]) + elif l[0] == 'tex': + tex.append (l[1] + '.ly') + elif l[0] == 'png': + gif.append (l[1]) + + if tex: + lilyopts = map (lambda x: '-I ' + x, include_path) + texfiles = string.join (tex, ' ') + lilyopts = string.join (lilyopts, ' ' ) + system ('lilypond %s %s' % (lilyopts, texfiles)) + + + for e in eps: + cmd = r"""tex %s; dvips -E -o %s %s""" % \ + (e, e + '.eps', e) + system (cmd) + + for g in gif: + cmd = r"""gs -sDEVICE=pgm -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=- -r90 -dNOPAUSE %s -c quit | pnmcrop | pnmtopng > %s""" + + cmd = cmd % (g + '.eps', g + '.png') + system (cmd) + + +def update_file (body, name): + same = 0 + try: + f = open (name) + fs = f.read (-1) + same = (fs == body) + except: + pass + + if not same: + f = open (name , 'w') + f.write (body) + f.close () + + + return not same + + + +def getopt_args (opts): + "Construct arguments (LONG, SHORT) for getopt from list of options." + short = '' + long = [] + for o in opts: + if o[1]: + short = short + o[1] + if o[0]: + short = short + ':' + if o[2]: + l = o[2] + if o[0]: + l = l + '=' + long.append (l) + return (short, long) + +def option_help_str (o): + "Transform one option description (4-tuple ) into neatly formatted string" + sh = ' ' + if o[1]: + sh = '-%s' % o[1] + + sep = ' ' + if o[1] and o[2]: + sep = ',' + + long = '' + if o[2]: + long= '--%s' % o[2] + + arg = '' + if o[0]: + if o[2]: + arg = '=' + arg = arg + o[0] + return ' ' + sh + sep + long + arg + + +def options_help_str (opts): + "Transform a list of options into a neatly formatted string" + w = 0 + strs =[] + helps = [] + for o in opts: + s = option_help_str (o) + strs.append ((s, o[3])) + if len (s) > w: + w = len (s) + + str = '' + for s in strs: + str = str + '%s%s%s\n' % (s[0], ' ' * (w - len(s[0]) + 3), s[1]) + return str def help(): - sys.stdout.write("""Usage: mudela-book [options] FILE\n + sys.stdout.write("""Usage: mudela-book [options] FILE\n Generate hybrid LaTeX input from Latex + mudela -Options:\n - -h, --help print this help - -d, --outdir=DIR directory to put generated files - -o, --outname=FILE prefix for filenames - --default-mudela-fontsize=??pt default fontsize for music - --force-mudela-fontsize=??pt force fontsize for all inline mudela - --force-verbatim make all mudela verbatim\n - --dependencies write dependencies - --include include path - --init mudela-book initfile - """ - ) - sys.exit (0) - - -def write_deps (fn, out, deps): - out_fn = os.path.join (outdir, fn) - - sys.stdout.write('writing `%s\'\n' % out_fn) +Options: +""") + sys.stdout.write (options_help_str (options)) + sys.stdout.write (r"""Warning all output is written in the CURRENT directory + + + +Report bugs to bug-gnu-music@gnu.org. + +Written by Tom Cato Amundsen and +Han-Wen Nienhuys +""") + + sys.exit (0) + + +def write_deps (fn, target, deps): + sys.stdout.write('writing `%s\'\n' % fn) + + f = open (fn, 'w') - f = open (out_fn, 'w') - target = re.sub (os.sep + os.sep, os.sep, os.path.join (outdir, out + '.latex')) - f.write ('%s: %s\n'% (target, - reduce (lambda x,y: x + ' '+ y, deps))) + target = target + '.latex' + f.write ('%s: %s\n'% (target, string.join (deps, ' '))) f.close () + def identify(): - sys.stderr.write ('This is %s version %s\n' % ('mudela-book', program_version)) + sys.stdout.write ('mudela-book (GNU LilyPond) %s\n' % program_version) + +def print_version (): + identify() + sys.stdout.write (r"""Copyright 1998--1999 +Distributed under terms of the GNU General Public License. It comes with +NO WARRANTY. +""") + def main(): - global outdir, initfile, defined_mudela_cmd, defined_mudela_cmd_re - outname = '' - try: - (options, files) = getopt.getopt( - sys.argv[1:], 'hd:o:I:', ['outdir=', 'outname=', - 'default-mudela-fontsize=', - 'force-mudela-fontsize=', - 'help', 'dependencies', 'include=', - 'force-verbatim', 'init=']) - except getopt.error, msg: - sys.stderr.write("error: %s" % msg) - sys.exit(1) - - do_deps = 0 - for opt in options: - o = opt[0] - a = opt[1] - if o == '--include' or o == '-I': - include_path.append (a) - elif o == '--outname' or o == '-o': - if len(files) > 1: - #HACK - sys.stderr.write("Mudela-book is confused by --outname on multiple files") - sys.exit(1) - outname = a - elif o == '--outdir' or o == '-d': - outdir = a - elif o == '--help' or o == '-h': - help () - elif o == '--dependencies': - do_deps = 1 - elif o == '--default-mudela-fontsize': - if not fontsize_pt2i.has_key(a): - sys.stderr.write("Error: invalid fontsize: %s" % a) - sys.stderr.write(" accepted fontsizes are: 11pt, 13pt, 16pt, 20pt, 26pt") - sys.exit() - Props.setMudelaFontsize(fontsize_pt2i[a], 'init') - elif o == '--force-mudela-fontsize': - if not fontsize_pt2i.has_key(a): - sys.stderr.write("Error: invalid fontsize: %s" % a) - sys.stderr.write(" accepted fontsizes are: 11pt, 13pt, 16pt, 20pt, 26pt") - sys.exit() - Props.force_mudela_fontsize = fontsize_pt2i[a] - elif o == '--force-verbatim': - Props.force_verbatim_b = 1 - elif o == '--init': - initfile = a - if outdir[-1:] != os.sep: - outdir = outdir + os.sep - - # r""" ... """ means: leave escape seqs alone. - defined_mudela_cmd = {'mudela': r""" -\begin{mudela}[eps, singleline \fontoptions] - \context Staff < - \context Voice{ - \maininput - } - > -\end{mudela} -"""} - if initfile != '': - f = open(initfile) - s = f.read() - f.close() - d = eval(s) - for i in d.keys(): - defined_mudela_cmd[i] = d[i] - del d - - c = string.join (defined_mudela_cmd.keys(), '|') - - defined_mudela_cmd_re = re.compile("\\\\(%s)(\[(\d*pt)\])*{([^}]*)}" %c) - - if not os.path.isdir(outdir): - os.system('mkdir %s' % outdir) - - for input_filename in files: - Props.clear_for_new_file() - if outname: - my_outname = outname - else: - my_outname = os.path.basename(os.path.splitext(input_filename)[0]) - my_depname = my_outname + '.dep' - inp = Main_tex_input (input_filename, my_outname) - inp.do_it () - if do_deps: - write_deps (my_depname, my_outname, inp.deps) - -identify() -Props = Properties() + global outdir, initfile, defined_mudela_cmd, defined_mudela_cmd_re + outname = '' + try: + (sh, long) = getopt_args (__main__.options) + (options, files) = getopt.getopt(sys.argv[1:], sh, long) + except getopt.error, msg: + sys.stderr.write("error: %s" % msg) + sys.exit(1) + + do_deps = 0 + for opt in options: + o = opt[0] + a = opt[1] + + if o == '--include' or o == '-I': + include_path.append (a) + elif o == '--version': + print_version () + sys.exit (0) + + elif o == '--format' or o == '-o': + __main__.format = a + elif o == '--outname' or o == '-o': + if len(files) > 1: + #HACK + sys.stderr.write("Mudela-book is confused by --outname on multiple files") + sys.exit(1) + outname = a + elif o == '--outdir' or o == '-d': + outdir = a + elif o == '--help' or o == '-h': + help () + elif o == '--dependencies': + do_deps = 1 + elif o == '--default-mudela-fontsize': + default_music_fontsize = string.atoi (a) + elif o == '--init': + initfile = a + + identify() + + for input_filename in files: + file_settings = {} + if outname: + my_outname = outname + else: + my_outname = os.path.basename(os.path.splitext(input_filename)[0]) + my_depname = my_outname + '.dep' + + (input, deps) = read_tex_file (input_filename) + (input, muds) = find_mudela_sections (input) + output = make_files (input, muds, my_outname) + output = completize_preamble (output) + + foutn = my_outname + '.' + format + sys.stderr.write ("Writing `%s'\n" % foutn) + fout = open (foutn, 'w') + + fout.write (output) + fout.close () + + if do_deps: + write_deps (my_depname, my_outname, deps) + main() diff --git a/stepmake/bin/make-version.py b/stepmake/bin/make-version.py new file mode 100644 index 0000000000..4912f0a2a7 --- /dev/null +++ b/stepmake/bin/make-version.py @@ -0,0 +1,27 @@ + +import re +import sys + + +vf = 'VERSION' +if sys.argv[1:]: + vf = sys.argv[1] + +f = open (vf) +ls = f.readlines () +mypatch = 0 +defs = [] +for l in ls: + l = re.sub ('#.*','', l) + m = re.search ('([^ =]*)[\t ]*=[ \t]*([^ \t]*)[ \t]*\n', l) + if m: + defs.append ((m.group(1), m.group(2))) + + +sys.stdout.write ('/* automatically generated */') +for d in defs: + sys.stdout.write ('#define %s \"%s\"\n' % d) + +if ('MY_PATCH_LEVEL', '') in defs: + sys.stdout.write ('#define NO_MY_PATCHLEVEL') + diff --git a/stepmake/bin/make-version.sh b/stepmake/bin/make-version.sh deleted file mode 100755 index 2324ac1443..0000000000 --- a/stepmake/bin/make-version.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -#shift; -if test "x$1" = x; -then - versionfile="VERSION" -else - versionfile=$1; -fi - -cat $versionfile| sed 's/#.*$//g'|sed 's/\([^ =]*\)[\t ]*=[ \t]*\([^ \t]*\)[ \t]*$/#define \1 \"\2\"/g' -echo - diff --git a/stepmake/stepmake/generic-targets.make b/stepmake/stepmake/generic-targets.make index c66a7aa4bc..4a2a70dbc4 100644 --- a/stepmake/stepmake/generic-targets.make +++ b/stepmake/stepmake/generic-targets.make @@ -131,7 +131,7 @@ $(outdir)/VERSION: $(depth)/VERSION cp $< $@ $(outdir)/version.hh: $(outdir)/VERSION - sh $(step-bindir)/make-version.sh $< > $@ + $(PYTHON) $(step-bindir)/make-version.py $< > $@ # should this be in Rules? configure: configure.in aclocal.m4 diff --git a/stepmake/stepmake/po-targets.make b/stepmake/stepmake/po-targets.make index 9b66622603..6b5e125743 100644 --- a/stepmake/stepmake/po-targets.make +++ b/stepmake/stepmake/po-targets.make @@ -23,7 +23,7 @@ ifneq ($(strip $(ALL_PO_SOURCES)),) @echo $(ALL_PO_SOURCES) xgettext --c++ --default-domain=$(package) --join \ --output-dir=$(po-dir)/$(outdir) --add-comments \ - --keyword=_ --keyword=_f $(ALL_PO_SOURCES) + --keyword=_ --keyword=_f --keyword=_i $(ALL_PO_SOURCES) endif endif -- 2.39.2