diff options
author | Karl Berry <karl@freefriends.org> | 2011-04-28 22:38:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-04-28 22:38:29 +0000 |
commit | a20e7c7a16f354351041a738cca750cfde65bcda (patch) | |
tree | 8c8aea75fa6dc67370613a1e083ef48d38890d2d /Build/source | |
parent | 502b428dee94827e6f7db02bd8c5d1ef7984d6aa (diff) |
musixtex (28apr11)
git-svn-id: svn://tug.org/texlive/trunk@22240 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/musixtex/musixtex.lua | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/musixtex/musixtex.lua b/Build/source/texk/texlive/linked_scripts/musixtex/musixtex.lua index 3d8c4482e0f..c567af06950 100755 --- a/Build/source/texk/texlive/linked_scripts/musixtex/musixtex.lua +++ b/Build/source/texk/texlive/linked_scripts/musixtex/musixtex.lua @@ -1,9 +1,9 @@ #!/usr/bin/env texlua -VERSION = "0.2" +VERSION = "0.3" --[[ - musixtex.lua: runs [pdf]etex -> musixflx -> [pdfe]tex [ -> dvips -> ps2pdf ] + musixtex.lua: processes a MusiXTeX file and then deletes intermediate files (c) Copyright 2011 Bob Tennent rdt@cs.queensu.ca @@ -27,6 +27,9 @@ VERSION = "0.2" ChangeLog: + version 0.3 2011-04-25 RDT + Add -d (dvipdfm) and -s (stop at dvi) options. + version 0.2 2011-04-21 RDT Allow basename.tex as filename. Add -p option for pdfetex processing. @@ -34,14 +37,13 @@ VERSION = "0.2" --]] - -tex = "etex" -musixflx = "musixflx" -dvips = "dvips -q" -ps2pdf = "ps2pdf" - function usage() - print("Usage: [texlua] musixtex.lua [options] basename[.tex]") + print("Usage: [texlua] musixtex.lua [option] [basename[.tex]]") + print("options: -v version") + print(" -h help") + print(" -p pdfetex") + print(" -d dvipdfm") + print(" -s stop at dvi") end function whoami () @@ -49,8 +51,9 @@ function whoami () end if #arg == 0 then + whoami() usage() - os.exit(1) + os.exit(0) end narg = 1 @@ -63,9 +66,19 @@ elseif arg[narg] == "-h" then os.exit(0) end -while narg ~= #arg do +-- defaults: +tex = "etex" +musixflx = "musixflx" +dvi = "dvips -q" +ps2pdf = "ps2pdf" + +if narg < #arg then if arg[narg] == "-p" then - tex = "pdfetex" + tex = "pdfetex"; dvi = ""; ps2pdf = "" + elseif arg[narg] == "-d" then + tex = "etex"; dvi = "dvipdfm"; ps2pdf = "" + elseif arg[narg] == "-s" then + tex = "etex"; dvi = ""; ps2pdf = "" else print("Argument \"".. arg[narg] .. "\" ignored.") end @@ -94,21 +107,32 @@ end whoami() print("Processing ".. basename .. ".tex") os.remove( basename .. ".mx2" ) -if - (os.execute(tex .. " " .. basename) == 0) - and (os.execute(musixflx .. " " .. basename) == 0) - and (os.execute(tex .. " " .. basename) == 0) - and (tex == "pdfetex" or (os.execute(dvips .. " -o " .. basename ..".ps " .. basename) == 0) ) - and (tex == "pdfetex" or (os.execute(ps2pdf .. " " .. basename .. ".ps " .. basename .. ".pdf") == 0) ) +if (os.execute(tex .. " " .. basename) == 0) and + (os.execute(musixflx .. " " .. basename) == 0) and + (os.execute(tex .. " " .. basename) == 0) and + (dvi == "" or (os.execute(dvi .. " " .. basename) == 0)) and + (ps2pdf == "" or (os.execute(ps2pdf .. " " .. basename .. ".ps") == 0) ) then - print(basename .. ".pdf generated.") + if dvi ~= "" then + print(basename .. ".pdf generated.") + end exit_code = 0 else - print("musixtex processing fails.") + print("Musixtex processing fails.") +--[[ uncomment for debugging + print("tex = ", tex) + print("dvi = ", dvi) + print("ps2pdf = ", ps2pdf) +--]] exit_code = 3 end + +-- clean-up: os.remove( basename .. ".mx1" ) os.remove( basename .. ".mx2" ) -os.remove( basename .. ".dvi" ) +if dvi ~= "" then + os.remove( basename .. ".dvi" ) +end os.remove( basename .. ".ps" ) + os.exit( exit_code ) |