From 9943c08d29026b5a582e15d661c9a0d0b5e37501 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 12 Apr 2001 01:19:22 +0200 Subject: [PATCH] patch::: 1.3.147.jcn1 1.3.147.jcn1 ============ * Fixed windows documentation. * Filled in tutorial section on windows. * Ly2dvi: don't use posix file utilities if we have python >= 1.5.2. * Included additional cygwin login and wrapper scripts. * Added cygwin path conversion to file-path.cc, to get output in cwd. After upgrading cross compilation environment to cygwin-1.1.8-2, it seems that these are no longer necessary; disabled by default. 1.3.147 ======= --- CHANGES | 18 ++++ Documentation/index.texi | 2 +- Documentation/topdocs/WINDOWS.texi | 44 ++++++--- Documentation/user/tutorial.itely | 89 +++++++++++++++++- Documentation/windows/GNUmakefile | 7 +- Documentation/windows/babysit.texi | 44 +++++++++ Documentation/windows/cygwin-installer.patch | 38 ++++---- Documentation/windows/gv.sh | 9 -- Documentation/windows/lily-python.sh | 3 + Documentation/windows/lily-tex.sh | 23 +++++ Documentation/windows/lily-wins.texi | 70 ++++++++++++++ Documentation/windows/lilypond-profile.z.sh | 43 +++++++++ Documentation/windows/ly2dvi-wrapper.sh | 13 +++ Documentation/windows/ly2dvi.sh | 8 -- VERSION | 2 +- flower/file-path.cc | 59 +++++++++++- lily/include/main.hh | 1 - lily/include/scm-option.hh | 15 +++ lily/main.cc | 6 +- lily/midi-item.cc | 1 + lily/midi-stream.cc | 1 + lily/scheme-option.cc | 78 --------------- lily/scm-option.cc | 99 ++++++++++++++++++++ scripts/ly2dvi.py | 84 +++++++++++------ scripts/update-lily.py | 2 +- 25 files changed, 592 insertions(+), 167 deletions(-) create mode 100644 Documentation/windows/babysit.texi create mode 100644 Documentation/windows/lily-python.sh create mode 100644 Documentation/windows/lily-tex.sh create mode 100644 Documentation/windows/lily-wins.texi create mode 100644 Documentation/windows/lilypond-profile.z.sh create mode 100644 Documentation/windows/ly2dvi-wrapper.sh create mode 100644 lily/include/scm-option.hh create mode 100644 lily/scm-option.cc diff --git a/CHANGES b/CHANGES index 0eefa79a99..72920d20de 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,21 @@ +1.3.147.jcn1 +============ + +* Fixed windows documentation. + +* Filled in tutorial section on windows. + +* Ly2dvi: don't use posix file utilities if we have python >= 1.5.2. + +* Included additional cygwin login and wrapper scripts. + +* Added cygwin path conversion to file-path.cc, to get output in cwd. +After upgrading cross compilation environment to cygwin-1.1.8-2, it +seems that these are no longer necessary; disabled by default. + +1.3.147 +======= + 1.3.146.jcn4 ============ diff --git a/Documentation/index.texi b/Documentation/index.texi index 2b895d9379..ae488127be 100644 --- a/Documentation/index.texi +++ b/Documentation/index.texi @@ -75,7 +75,6 @@ by computer}. @itemize @bullet -@item @uref{README-W32.html,Compiling and running on Windows32} @item @uref{../misc/out-www/CHANGES-0.0.html, Change logs from 0.0 till 0.1 } @item @uref{../misc/out-www/CHANGES-0.1.html, Change logs from 0.1 till 1.0 } @item @uref{../misc/out-www/CHANGES-1.0.html, Change logs from 1.0 till 1.1 } @@ -90,6 +89,7 @@ changes)} @item @uref{../misc/out-www/ANNOUNCE-1.2.html, Announcement of 1.2 (includes summary of changes)} @item @uref{../misc/out-www/AIMS.html, Why LilyPond?} @item @uref{../misc/out-www/interview.html, Answers} to the Brave GNU world standard questions. +@item @uref{../windows/out-www/lily-wins.html, Lily Wins} @end itemize diff --git a/Documentation/topdocs/WINDOWS.texi b/Documentation/topdocs/WINDOWS.texi index 1a17d08fe6..f4629b1893 100644 --- a/Documentation/topdocs/WINDOWS.texi +++ b/Documentation/topdocs/WINDOWS.texi @@ -22,12 +22,14 @@ You need the following packages to compile Lilypond on Windows. @table @code @item The GNU + Cygnus tools, 1.1.7 or newer. Check out the @uref{http://sources.redhat.com/cygwin,Cygwin webpage}. -@item GUILE 1.4, or newer. -Check out the @uref{http://www.gnu.org/software/guile.html,GUILE webpage} -@end table - You can get the latest version of the GNU + Cygnus tools from cygnus @uref{http://sources.redhat.com/cygwin/mirrors.html,mirror site}. +Install everything, including tetex. +@item GUILE 1.4, or newer. +Check out the @uref{http://www.gnu.org/software/guile.html,GUILE +webpage}. You may need the patch @file{guile-1.4-gnu-windows.patch} +included in LilyPond's source distribution. +@end table @section Windows precompiled binaries @@ -39,8 +41,10 @@ LilyPond on Windows}. This will install the minimal set of cygwin tools needed to run LilyPond. If you already have cygwin installed, don't worry: nothing -will be installed twice. - +will be installed twice. To expand on this minimal set, click +@uref{http://sources.redhat.com/cygwin/setup.exe,here}, +or visit a Cygwin +@uref{http://sources.redhat.com/cygwin/mirrors.html,mirror site}. @end table Note that none of the developers uses Windows, of course. In fact, we @@ -50,7 +54,7 @@ users trying to compile LilyPond themselves. These binaries are cross compiled for Windows on a GNU/Linux box. You may want to check out the -@uref{http://appel.lilypond.org/lilypond/gnu-windows/cross.tar.gz,cross +@uref{http://appel.lilypond.org/lilypond/gnu-windows/cross-1.1.8.tar.gz,cross compilation scripts}. @section Windows running requirements @@ -62,11 +66,29 @@ following software @item GUILE Included in binary installation. @item TeX -A full TeX installation. See /usr/share/doc/tetex-beta for details. -@item GSView -Click @uref{ftp://ftp.cs.wisc.edu/ghost/ghostgum/gsv36w32.exe,here} to -install GSView (GhostView for Windows), or visit +A full TeX installation. +Click +@uref{http://prdownloads.sourceforge.net/miktex/miktex-2.0-lvl-1.zip,here} +to install basic MiKTeX commands, +or visit @uref{http://www.miktex.org,www.miktex.org}. +@c See @file{/usr/doc/cygwin/tetex-beta-20001218.README} for details. +@item PostScript tools +@table @code +@item GSView-2.6, or +Click @uref{ftp://ftp.cs.wisc.edu/ghost/ghostgum/gsv26w32.exe,here} to +install GSView-2.6 (GhostView for Windows), or visit +@uref{ftp://ftp.cs.wisc.edu/ghost/ghostgum,ftp.cs.wisc.edu}. + +@item GSView-3.6 and GhostScript-6.50 +Click @uref{ftp://ftp.cs.wisc.edu/ghost/ghostgum/gsv36w32.exe,here} for +GSview and +Click @uref{ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/gs650/gs650w32.exe +,here} for GhostScript. @uref{ftp://ftp.cs.wisc.edu/ghost/ghostgum,ftp.cs.wisc.edu}. +or visit the +@uref{http://www.cs.wisc.edu/~ghost/,Ghostscript, Ghostview and GSview site}. +@end table + @item Python Click @uref{http://www.python.org/ftp/python/win32/py152.exe,here} to install Python-1.5.2, or visit @uref{http://www.python.org,www.python.org}. diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index 944fdb9142..bc3a3475d2 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -111,6 +111,8 @@ To view the @code{test.dvi} output, run Xdvi (you may omit the xdvi test @end example +@c FIXME: should we say anything on xdvi-gs interaction? + You should see the following in a window next to some buttons. @lilypond \score { @@ -134,13 +136,94 @@ GhostScript's website at @uref{http://www.ghostscript.com}. @cindex PostScript @cindex .ps + @unnumberedsubsec Windows -@strong{[TODO]} -* setting of env vars (TFMFONTS,MFINPUTS,TEXINPUTS) +On windows, you open a LilyPond shell, and then you invoke ly2dvi +compile your lilypond source file, just like on Unix: + +@example +ly2dvi -P test +@end example + +You will see the following on your screen: + +@c FIXME: leave this out, just refer to unix section? +@c FIXME: commands run in dos shell: we can't redirect output +@example +GNU LilyPond 1.3.147 +Now processing: `C:\cygwin\home\tim\ly\test.ly' +Parsing... +Interpreting music...[1] +Preprocessing elements... +Calculating column positions... [2] +paper output to test.tex... + +This is TeX, Version 3.14159 (MiKTeX 2) +LaTeX2e <2000/06/01> +Babel and hyphenation patterns for english, french, german, ngerman, du +mylang, nohyphenation, loaded. + +(test.latex (C:\Program Files\MiKTeX\tex\latex\base\article.cls +Document Class: article 2000/05/19 v1.4b Standard LaTeX document class +(C:\Program Files\MiKTeX\tex\latex\base\size10.clo)) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\geometry.sty +(C:\Program Files\MiKTeX\tex\latex\graphics\keyval.sty)) +(C:\Program Files\MiKTeX\tex\latex\base\inputenc.sty +(C:\Program Files\MiKTeX\tex\latex\base\latin1.def)) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\titledefs.tex) +No file test.aux. +(test.tex +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\lilyponddefs.tex +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\lilypond-latex.tex +LaTeX definitions) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\feta20.tex) +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\lily-ps-defs.tex) +[footer empty] +(C:\cygwin\usr\lilypond-1.3.147\share\lilypond\tex\fetdefs.tex))) +Overfull \hbox (15.0pt too wide) in paragraph at lines 22--26 +[] $[]$ +[1] (test.aux) ) +(see the transcript file for additional information) +Output written on test.dvi (1 page, 4292 bytes). +Transcript written on test.log. +This is dvips(k) 5.86 Copyright 1999 Radical Eye Software (www.radicaleye.com) +' TeX output 2001.04.12:0033' -> test.ps +. [1] +Running LilyPond... +Analyzing test.tex... +Running LaTeX... +Running dvips... +PS output to test.ps... +DVI output to test.dvi... +@end example + +To view the @code{test.dvi} output, run Yap + +@example +yap test +@end example + +You should see the following in a window +@lilypond +\score { + \notes { c'4 e' g' } +} +@end lilypond + +@c FIXME: talk about newer Yap versions, proper gs installation? +When you're satisfied with the result, you can print from within Yap +(File/Print). Note that Yap may not display embedded PostScript symbols +such as beams and slurs. Don't worry, they'll be printed anyway. + +You can also print the PostScript file directly from the +command line using GSview: + +@example +gsview32 /s test.ps +@end example -* dvi viewer doesn't display postscript @node The first tune diff --git a/Documentation/windows/GNUmakefile b/Documentation/windows/GNUmakefile index 9e7b37ea23..8351c3d69e 100644 --- a/Documentation/windows/GNUmakefile +++ b/Documentation/windows/GNUmakefile @@ -3,8 +3,11 @@ depth=../.. EXTRA_DIST_FILES = LilyPond.ico $(wildcard *.sh *.patch) -STEPMAKE_TEMPLATES=documentation +STEPMAKE_TEMPLATES=documentation texinfo include $(depth)/make/stepmake.make -default: +default: local-doc + +local-WWW: + diff --git a/Documentation/windows/babysit.texi b/Documentation/windows/babysit.texi new file mode 100644 index 0000000000..ae9279a9b2 --- /dev/null +++ b/Documentation/windows/babysit.texi @@ -0,0 +1,44 @@ +\input texinfo @c -*-texinfo-*- +@setfilename babysit.info +@settitle Babysit Windows Install Wizard + +@node Top +@top + +@chapter Babysit Windows Install Wizard + +@example +www.lilypond.org + :Windows Unstable(1) + :setup.exe(2) +Netscape + Unknown file type + :Save file(3) +Save as + :Drop-down(4) :Select Desktop(5) +Save as + :Save(6) +Save as + C:\WINDOWS\Desktop\setup.exe already exist + Do you want to replace it? :Yes(7) +Desktop + :setup.exe(8) :setup.exe(9) +GNU LilyPond Setup + Setup.exe version 2.40 :Next(10) + :X(11) Install from internet :Next(12) + Local Package Directory + :Browse(13) :C:\tmp(14) :Ok(15) :Next(16) + Select install root directory + C:/cygwin :Next(17) + :X Direct internet connection(18) :Next(19) + Select Download Site + :http://appel.lilypond.org(20) :Next(21) + Select Packages to install (all) :Next(22) + :X Create Desktop() Icon + :X Add to Start Menu(23) :Next(24) + Installation Complete :Ok(25) +Desktop + :GNU LilyPond(26):GNU LilyPond(27) +@end example + +@bye diff --git a/Documentation/windows/cygwin-installer.patch b/Documentation/windows/cygwin-installer.patch index a1cc83c86b..551e99db37 100644 --- a/Documentation/windows/cygwin-installer.patch +++ b/Documentation/windows/cygwin-installer.patch @@ -1,17 +1,19 @@ -Binary files ../cinstall/LilyPond.ico and ./LilyPond.ico differ +Only in .: LilyPond.ico diff -urN ../cinstall/Makefile.in ./Makefile.in --- ../cinstall/Makefile.in Thu Feb 8 05:55:22 2001 -+++ ./Makefile.in Sun Apr 8 19:54:54 2001 -@@ -130,11 +130,15 @@ ++++ ./Makefile.in Tue Apr 10 19:20:14 2001 +@@ -130,11 +130,16 @@ @chmod a-x $@ clean: - rm -f *.o *.rc $(PROGS) +- $(MAKE) -C zlib clean + rm -f *.o $(PROGS) - $(MAKE) -C zlib clean ++ $(MAKE) -C zlib $@ realclean: clean rm -f Makefile config.cache ++ rm -f *.d + rm -f inilex.c iniparse.c iniparse.h version.c config.log config.status *.d + + @@ -21,20 +23,19 @@ diff -urN ../cinstall/Makefile.in ./Makefile.in $(SHELL) $(updir1)/mkinstalldirs $(bindir) $(etcdir) diff -urN ../cinstall/desktop.cc ./desktop.cc --- ../cinstall/desktop.cc Sat Nov 11 05:55:16 2000 -+++ ./desktop.cc Sun Apr 8 21:52:48 2001 -@@ -85,6 +85,11 @@ ++++ ./desktop.cc Tue Apr 10 19:15:01 2001 +@@ -79,9 +79,7 @@ + "done", + "", + "export MAKE_MODE=unix", +- "export PS1='\\[\\033]0;\\w\\007", +- "\\033[32m\\]\\u@\\h \\[\\033[33m\\w\\033[0m\\]", +- "$ '", ++ "export PS1='\\[\\033]0;\\w\\007\\033[32m\\]\\u@\\h \\[\\033[33m\\w\\033[0m\\]$ '", "", "cd \"$HOME\"", "", -+ "PATH=\"/usr/lilypond/bin:$PATH\"", -+ "if [ ! -e \"/usr/lilypond\" ]; then", -+ " ln -s `tail -1 /usr/lilypond-*` /usr/lilypond", -+ "fi", -+ "", - "test -f ./.bashrc && . ./.bashrc", - 0 - }; -@@ -197,6 +202,30 @@ +@@ -197,6 +195,30 @@ } static void @@ -65,7 +66,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc make_etc_profile () { char *fname = concat (root_dir, "/etc/profile", 0); -@@ -299,11 +328,11 @@ +@@ -299,11 +321,11 @@ } static void @@ -80,7 +81,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc if (rsrc == NULL) { fatal ("FindResource failed"); -@@ -323,7 +352,7 @@ +@@ -323,7 +345,7 @@ static void do_desktop_setup() { @@ -89,7 +90,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc make_cygwin_bat (); make_etc_profile (); -@@ -335,6 +364,17 @@ +@@ -335,6 +357,17 @@ if (root_desktop) { desktop_icon ("Cygwin", batname); @@ -350,3 +351,4 @@ diff -urN ../cinstall/resource.h ./resource.h #define IDC_SOURCE_DOWNLOAD 1000 #define IDC_SOURCE_NETINST 1001 #define IDC_SOURCE_CWD 1002 +Common subdirectories: ../cinstall/zlib and ./zlib diff --git a/Documentation/windows/gv.sh b/Documentation/windows/gv.sh index 8346a38e8e..e69de29bb2 100644 --- a/Documentation/windows/gv.sh +++ b/Documentation/windows/gv.sh @@ -1,9 +0,0 @@ -#!/bin/bash -if echo | gsview32 -; then - cat < +@end example +and of course, the maybe even more hollow message that tells us there's +nothing to be told, really: +@example +GNU LilyPond Setup + + Installation completed. + + [O]k +@end example +Yes, that's right. Farewell nightly upgrades. Even a click at the +@emph{very end} is required, so that you actually feel very useful +babysitting the whole process. How about that, eh? + +No, it's no longer needed to @uref{http://www.gnu.org/software/wget, +download} +@uref{http://appel.lilypond.org/gnu-windows/tar/lilypond/lilypond-1.3.147-1.tar.gz,tarballs} +or move @uref{http://www.gnu.org/software/guile, all sorts of files} +@uref{http://www.mail-archive.com/gnu-music-discuss@@gnu.org/msg04380.html, +around} after automagically @uref{http://www.winzip.com,unpacking} and +@uref{http://mail.gnu.org/pipermail/gnu-music-discuss/2000-October/000517.html, +flattening} the @uref{http://www.lilypond.org,LilyPond} tarball. + + +No +@uref{http://appel.lilypond.org/lilypond/gnu-windows/tar/lilypond/md5.sum, +difficult checksums} or signatures. Enjoy and feel the thrill when +running @uref{http://appel.lilypond.org/lilypond/gnu-windows/setup.exe, +untrusted binaries} with adminstrator rights, on your painfully +firewalled intranet. + +@bye diff --git a/Documentation/windows/lilypond-profile.z.sh b/Documentation/windows/lilypond-profile.z.sh new file mode 100644 index 0000000000..444c94c8ba --- /dev/null +++ b/Documentation/windows/lilypond-profile.z.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# /etc/profile.d/lilypond-profile.z.sh -- profile additions for Windows +# run after lilypond-profile.sh + +POSIX_GS_LIB="$(cygpath -apu $GS_LIB)" +WINDOWS_GS_LIB="$(cygpath -apw $POSIX_GS_LIB)" + +POSIX_GS_FONTPATH="$(cygpath -apu $GS_FONTPATH)" +WINDOWS_GS_FONTPATH="$(cygpath -apw $POSIX_GS_FONTPATH)" + +POSIX_TEXINPUTS="$(cygpath -apu $TEXINPUTS)" +WINDOWS_TEXINPUTS="$(cygpath -apw $POSIX_TEXINPUTS)" + +POSIX_TFMFONTS="$(cygpath -apu $TFMFONTS)" +WINDOWS_TFMFONTS="$(cygpath -apw $POSIX_TFMFONTS)" + +POSIX_MFINPUTS="$(cygpath -apu $MFINPUTS)" +WINDOWS_MFINPUTS="$(cygpath -apw $POSIX_MFINPUTS)" + +# we assume running dos-based TeX, ie, MiKTeX +# maybe move to /etc/profile.d/lily-tex.sh +TEXINPUTS="$WINDOWS_TEXINPUTS" +# TFMFONTS="$WINDOWS_TFMFONTS" + +rm -f /usr/lilypond +# ugh +# ln -s /usr/lilypond-@TOPLEVEL_VERSION@ /usr/lilypond +lily=$(ls -utrd1 /usr/lilypond-* | tail -1) +ln -s $lily /usr/lilypond + +PATH="/usr/lilypond/bin:$PATH" +PATH="$lily/bin:$PATH" + +# gsv-2.7-gs-5.50 +PATH="//c/gstools/gsview://c/gstools/gs:$PATH" + +# gsv-3.6-gs-6.50 +PATH="//c/Ghostgum/gsview://c/gstools/gs:$PATH" + +# python-1.5.2 +PATH="//c/Program Files/Python:$PATH" +PATH="//c/Program Files/MiKTeX/miktex:$PATH" + diff --git a/Documentation/windows/ly2dvi-wrapper.sh b/Documentation/windows/ly2dvi-wrapper.sh new file mode 100644 index 0000000000..1a8a71013d --- /dev/null +++ b/Documentation/windows/ly2dvi-wrapper.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# ly2dvi.sh -- ly2dvi wrapper for Windows + +if echo | python - >/dev/null 2>&1; then + echo +else + cat < #include +#include #if HAVE_SYS_STAT_H #include #endif +#ifdef __CYGWIN__ +#include + +// URGURG +#include "../lily/include/scm-option.hh" +#endif + #include "file-path.hh" @@ -30,6 +38,38 @@ #define EXTSEP '.' #endif + + +#ifdef __CYGWIN__ +static String +dos_to_posix (String path) +{ + char buf[PATH_MAX]; + char *filename = path.copy_ch_p (); + /* urg, wtf? char const* argument gets modified! */ + cygwin_conv_to_posix_path (filename, buf); + delete filename; + return buf; +} + +static String +dos_to_posix_list (String path) +{ + char *filename = path.copy_ch_p (); + int len = cygwin_win32_to_posix_path_list_buf_size (filename); + if (len < PATH_MAX) + len = PATH_MAX; + char *buf = new char[len]; + /* urg, wtf? char const* argument gets modified! */ + cygwin_win32_to_posix_path_list (filename, buf); + delete filename; + + String ret = buf; + delete buf; + return ret; +} +#endif /* __CYGWIN__ */ + /* Join components to full path. */ String Path::str () const @@ -52,6 +92,13 @@ Path::str () const Path split_path (String path) { +#ifdef __CYGWIN__ + /* All system functions would work, even if we don't convert to + posix path, but we'd think that \foe\bar\baz.ly is in the cwd. */ + if (testing_level_global & 1) + path = dos_to_posix (path); +#endif + Path p; int i = path.index_i (ROOTSEP); if (i >= 0) @@ -81,6 +128,11 @@ split_path (String path) void File_path::parse_path (String p) { +#ifdef __CYGWIN__ + if (testing_level_global & 4) + p = dos_to_posix_list (p); +#endif + int l; while ((l = p.length_i ()) ) @@ -162,13 +214,18 @@ File_path::try_add (String s) return false; fclose (f); - push (s); + add (s); return true; } void File_path::add (String s) { +#ifdef __CYGWIN__ + if (testing_level_global & 2) + s = dos_to_posix (s); +#endif + push (s); } diff --git a/lily/include/main.hh b/lily/include/main.hh index a3287237f5..bf3e931892 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -25,7 +25,6 @@ extern void set_inclusion_names (Array); extern bool dependency_global_b; extern String dependency_prefix_global; extern Array dump_header_fieldnames_global; -extern bool midi_debug_global_b; extern bool no_paper_global_b; extern String output_format_global; extern String output_name_global; diff --git a/lily/include/scm-option.hh b/lily/include/scm-option.hh new file mode 100644 index 0000000000..3fe5a748cb --- /dev/null +++ b/lily/include/scm-option.hh @@ -0,0 +1,15 @@ +/* + scm-option.hh -- declare Scheme options + + source file of the GNU LilyPond music typesetter + + (c) 2001 Jan Nieuwenhuizen +*/ +#ifndef SCM_OPTION_HH +#define SCM_OPTION_HH + +/* options */ +extern bool midi_debug_global_b; +extern int testing_level_global; + +#endif /* SCM_OPTION_HH */ diff --git a/lily/main.cc b/lily/main.cc index fe1d00cef8..513054c763 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -101,20 +101,18 @@ static Getopt_long *oparser_p_static = 0; follow regular localisation guidelines). */ static Long_option_init options_static[] = { + {_i ("EXPR"), "evaluate", 'e',_i ("evalute EXPR as Scheme after .scm init is read")}, /* another bug in option parser: --output=foe is taken as an abbreviation for --output-format */ - // {_i ("EXT"), "output-format", 'f', _i ("use output format EXT (scm, ps, tex or as)")}, - {_i ("EXT"), "format", 'f', _i ("use output format EXT (scm, ps, tex or as)")}, {0, "help", 'h', _i ("this help")}, {_i ("FIELD"), "header", 'H', _i ("write header field to BASENAME.FIELD")}, {_i ("DIR"), "include", 'I', _i ("add DIR to search path")}, {_i ("FILE"), "init", 'i', _i ("use FILE as init file")}, {0, "dependencies", 'M', _i ("write Makefile dependencies for every input file")}, - {_i ("DIR"), "dep-prefix", 'P', _i ("prepend DIR to dependencies")}, - {_i ("EXPR"), "evaluate", 'e',_i ("evalute EXPR as Scheme after .scm init is read")}, {0, "no-paper", 'm', _i ("produce MIDI output only")}, {_i ("FILE"), "output", 'o', _i ("write output to FILE")}, + {_i ("DIR"), "dep-prefix", 'P', _i ("prepend DIR to dependencies")}, {0, "safe", 's', _i ("inhibit file output naming and exporting")}, {0, "version", 'v', _i ("print version number")}, {0, "verbose", 'V', _i ("verbose")}, diff --git a/lily/midi-item.cc b/lily/midi-item.cc index fb3d1eb5e6..80d3e6e6bc 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -15,6 +15,7 @@ #include "midi-stream.hh" #include "audio-item.hh" #include "duration.hh" +#include "scm-option.hh" #include "killing-cons.tcc" diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 359d831834..a2e4d7d5d7 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -15,6 +15,7 @@ #include "midi-item.hh" #include "midi-stream.hh" #include "debug.hh" +#include "scm-option.hh" Midi_stream::Midi_stream (String filename) { diff --git a/lily/scheme-option.cc b/lily/scheme-option.cc index 16b2a9d830..e69de29bb2 100644 --- a/lily/scheme-option.cc +++ b/lily/scheme-option.cc @@ -1,78 +0,0 @@ -/* - scheme-option.cc -- implement option setting from Scheme - - source file of the GNU LilyPond music typesetter - - (c) 2001 Han-Wen Nienhuys - - */ - -#include "lily-guile.hh" - -/* - TODO: mooie onschuldige test, en koel om allerleide dingen te kunnen zetten, - maar is dit nou wel handig voor gebruikert? - - -X, of -fps is hendiger dan - - -e "(set-lily-option 'midi-debug #t)' - - [niet voor niets tiepo in 139 announs..] - -*/ -/* Write midi as formatted ascii stream? */ -bool midi_debug_global_b; - - -/* - - Todo: print help text. - - - other interesting stuff to add: - -@item -T,--no-timestamps -don't timestamp the output - -@item -t,--test -Switch on any experimental features. Not for general public use. - - */ - -SCM -set_lily_option (SCM var, SCM val) -{ - if (var == ly_symbol2scm ("midi-debug")) - { - midi_debug_global_b = to_boolean (val); - } - else if (var == ly_symbol2scm ("find-old-relative")) - { - /* - Seems to have been broken for some time! - - @item -Q,--find-old-relative - show all changes needed to convert a file to relative octave syntax. - - - - */ - - ; - - } - - return SCM_UNSPECIFIED; -} - - -static void -init_functions () -{ - scm_make_gsubr ("set-lily-option", 2, 0, 0, (Scheme_function_unknown)set_lily_option); -} - - -ADD_SCM_INIT_FUNC (init_functions_sopt, init_functions); - - diff --git a/lily/scm-option.cc b/lily/scm-option.cc new file mode 100644 index 0000000000..666f08c575 --- /dev/null +++ b/lily/scm-option.cc @@ -0,0 +1,99 @@ +/* + scm-option.cc -- implement option setting from Scheme + + source file of the GNU LilyPond music typesetter + + (c) 2001 Han-Wen Nienhuys + + */ + +#include +#include "string.hh" +#include "lily-guile.hh" +#include "scm-option.hh" + +/* + TODO: mooie onschuldige test, en koel om allerleide dingen te kunnen zetten, + maar is dit nou wel handig voor gebruikert? + + -X, of -fps is hendiger dan + + -e "(set-lily-option 'midi-debug #t)' + + [niet voor niets tiepo in 139 announs..] + +*/ + + +/* Write midi as formatted ascii stream? */ +bool midi_debug_global_b; +/* General purpose testing flag */ +int testing_level_global; + + +/* + + TODO: verzin iets tegen optie code bloot + + + other interesting stuff to add: + +@item -T,--no-timestamps +don't timestamp the output + +@item -t,--test +Switch on any experimental features. Not for general public use. + + */ + +SCM +set_lily_option (SCM var, SCM val) +{ + if (var == ly_symbol2scm ("help")) + { + cout << '\n'; + cout << _ ("Scheme options:"); + cout << "help"; + cout << "midi-debug (boolean)"; + cout << "testing-level (int)"; + cout << '\n'; + exit (0); + } + else if (var == ly_symbol2scm ("midi-debug")) + { + midi_debug_global_b = to_boolean (val); + } + else if (var == ly_symbol2scm ("testing-level")) + { + testing_level_global = gh_scm2int (val); + } + else if (var == ly_symbol2scm ("find-old-relative")) + { + /* + Seems to have been broken for some time! + + @item -Q,--find-old-relative + show all changes needed to convert a file to relative octave syntax. + + + + */ + + ; + + } + + return SCM_UNSPECIFIED; +} + + +static void +init_functions () +{ + scm_make_gsubr ("set-lily-option", 2, 0, 0, (Scheme_function_unknown)set_lily_option); +} + + +ADD_SCM_INIT_FUNC (init_functions_sopt, init_functions); + + diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 4a67ce26e6..56a0450df1 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -45,8 +45,6 @@ TODO: * multiple \score blocks? - * windows-sans-cygwin compatibility? rm -rf, cp file... dir - ''' @@ -56,6 +54,7 @@ import string import re import getopt import sys +import shutil import __main__ import operator import tempfile @@ -111,9 +110,6 @@ targets = { track_dependencies_p = 0 dependency_files = [] -# be verbose? -verbose_p = 0 - # lily_py.py -- options and stuff # @@ -169,17 +165,19 @@ Distributed under terms of the GNU General Public License. It comes with NO WARRANTY.''')) sys.stdout.write ('\n') +if ( os.name == 'posix' ): + errorport=sys.stderr +else: + errorport=sys.stdout + def progress (s): - sys.stderr.write (s + '\n') + errorport.write (s + '\n') def warning (s): - sys.stderr.write (_ ("warning: ") + s) - sys.stderr.write ('\n') - + progress (_ ("warning: ") + s) def error (s): - sys.stderr.write (_ ("error: ") + s) - sys.stderr.write ('\n') + progress (_ ("error: ") + s) raise _ ("Exiting ... ") def getopt_args (opts): @@ -279,7 +277,7 @@ def cleanup_temp (): if not keep_temp_dir_p: if verbose_p: progress (_ ("Cleaning %s...") % temp_dir) - system ('rm -rf %s' % temp_dir) + shutil.rmtree (temp_dir) def set_setting (dict, key, val): @@ -321,9 +319,11 @@ option_definitions = [ def run_lilypond (files, outbase, dep_prefix): opts = '--output=%s.tex' % outbase - opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, include_path)) + opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, + include_path)) if paper_p: - opts = opts + ' ' + string.join (map (lambda x : '-H ' + x, fields)) + opts = opts + ' ' + string.join (map (lambda x : '-H ' + x, + fields)) else: opts = opts + ' --no-paper' @@ -500,7 +500,7 @@ def global_latex_definition (tfiles, extra): first = 0 s = s + r''' -% I don't see why we want to clobber the footer here +% I do not see why we want to clobber the footer here \vfill\hfill\parbox{\textwidth}{\mbox{}\makelilypondtagline} %\makeatletter %\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\makelilypondtagline}}% @@ -518,7 +518,10 @@ def run_latex (files, outbase, extra): f.write (s) f.close () - cmd = 'latex \\\\nonstopmode \\\\input %s' % outbase + '.latex' + if ( os.name == 'posix' ): + cmd = 'latex \\\\nonstopmode \\\\input %s' % outbase + '.latex' + else: + cmd = 'latex \\nonstopmode \\input %s' % outbase + '.latex' if not verbose_p: progress ( _("Running %s...") % 'LaTeX') cmd = cmd + ' 1> /dev/null 2> /dev/null' @@ -529,16 +532,17 @@ def run_dvips (outbase, extra): opts = '' if extra['papersize']: - opts = opts + ' -t %s' % extra['papersize'][0] + opts = opts + ' -t%s' % extra['papersize'][0] if extra['orientation'] and extra['orientation'][0] == 'landscape': - opts = opts + ' -t landscape' + opts = opts + ' -tlandscape' - cmd = 'dvips %s -o %s %s' % (opts, outbase + '.ps', outbase + '.dvi') + cmd = 'dvips %s -o%s %s' % (opts, outbase + '.ps', outbase + '.dvi') if not verbose_p: progress ( _("Running %s...") % 'dvips') - cmd = cmd + ' 2> /dev/null' + if os.name == 'posix': + cmd = cmd + ' 1> /dev/null 2> /dev/null' system (cmd) @@ -606,12 +610,35 @@ for opt in options: warranty () sys.exit (0) + +def cp_to_dir (pattern, dir): + "Copy files matching re PATTERN from cwd to DIR" + # Duh. Python style portable: cp *.EXT OUTDIR + # system ('cp *.%s %s' % (ext, outdir), 1) + files = filter (lambda x, p=pattern: re.match (p, x), os.listdir ('.')) + map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files) + +# Python < 1.5.2 compatibility +# # On most platforms, this is equivalent to #`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2* -def compat_abspath (path): - return os.path.normpath (os.path.join (os.getcwd (), path)) +if os.path.__dict__.has_key ('abspath'): + abspath = os.path.abspath +else: + def abspath (path): + return os.path.normpath (os.path.join (os.getcwd (), path)) + +if os.__dict__.has_key ('makedirs'): + makedirs = os.makedirs +else: + def makedirs (dir, mode=0777): + system ('mkdir -p %s' % dir) + +def mkdir_p (dir, mode=0777): + if not os.path.isdir (dir): + makedirs (dir, mode) -include_path = map (compat_abspath, include_path) +include_path = map (abspath, include_path) original_output = output @@ -625,7 +652,7 @@ if files and files[0] != '-': for i in ('.dvi', '.latex', '.ly', '.ps', '.tex'): output = strip_extension (output, i) - files = map (compat_abspath, files) + files = map (abspath, files) if os.path.dirname (output) != '.': dep_prefix = os.path.dirname (output) @@ -633,7 +660,7 @@ if files and files[0] != '-': dep_prefix = 0 reldir = os.path.dirname (output) - (outdir, outbase) = os.path.split (compat_abspath (output)) + (outdir, outbase) = os.path.split (abspath (output)) setup_environment () setup_temp () @@ -674,7 +701,7 @@ if files and files[0] != '-': run_dvips (outbase, extra) if outdir != '.' and (track_dependencies_p or targets.keys ()): - system ('mkdir -p %s' % outdir) + mkdir_p (outdir, 0777) # add DEP to targets? if track_dependencies_p: @@ -685,8 +712,7 @@ if files and files[0] != '-': for i in targets.keys (): ext = string.lower (i) - if re.match ('.*[.]%s' % ext, string.join (os.listdir ('.'))): - system ('cp *.%s %s' % (ext, outdir)) + cp_to_dir ('.*\.%s$' % ext, outdir) outname = outbase + '.' + string.lower (i) abs = os.path.join (outdir, outname) if reldir != '.': @@ -702,7 +728,7 @@ if files and files[0] != '-': else: # FIXME help () - sys.stderr.write ('\n') + progress ('\n') try: error (_ ("no FILEs specified, can't invoke as filter")) except: diff --git a/scripts/update-lily.py b/scripts/update-lily.py index 97e4b58d36..49b6c8170e 100644 --- a/scripts/update-lily.py +++ b/scripts/update-lily.py @@ -415,7 +415,7 @@ if 1: latest = find_latest (url) if os.path.isdir ('%s/%s' % (build_root, latest)): - progress (_ ("latest is %s") % latest) + progress (_ ("latest is: %s") % latest) progress (_ ("relax, %s is up to date" % package_name)) sys.exit (0) -- 2.39.2