diff options
Diffstat (limited to 'Master/texmf-dist/scripts/musixtex/musixtex.lua')
-rwxr-xr-x | Master/texmf-dist/scripts/musixtex/musixtex.lua | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/Master/texmf-dist/scripts/musixtex/musixtex.lua b/Master/texmf-dist/scripts/musixtex/musixtex.lua index 6bac25e8d8a..1386db71fde 100755 --- a/Master/texmf-dist/scripts/musixtex/musixtex.lua +++ b/Master/texmf-dist/scripts/musixtex/musixtex.lua @@ -1,11 +1,11 @@ #!/usr/bin/env texlua -VERSION = "0.4" +VERSION = "0.6" --[[ musixtex.lua: processes MusiXTeX files (and deletes intermediate files) - (c) Copyright 2011 Bob Tennent rdt@cs.queensu.ca + (c) Copyright 2012 Bob Tennent rdt@cs.queensu.ca This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -26,6 +26,11 @@ VERSION = "0.4" --[[ ChangeLog: + version 0.6 2012-09-14 RDT + Add -1 (one-pass [pdf][la]tex processing) option. + + version 0.5 2011-11-28 RDT + Add -i (retain intermediate files) option. version 0.4 2011-04-30 RDT Allow multiple filenames (and options). @@ -49,6 +54,8 @@ function usage() print(" -p pdfetex (or pdflatex)") print(" -d dvipdfm") print(" -s stop at dvi") + print(" -i retain intermediate files") + print(" -1 one-pass [pdf][la]tex processing") print(" -f restore default processing") end @@ -66,7 +73,9 @@ end tex = "etex" musixflx = "musixflx" dvi = "dvips" -ps2pdf = "ps2pdf" +ps2pdf = "/usr/local/bin/ps2pdf" +intermediate = 1 +passes = 2 exit_code = 0 narg = 1 @@ -94,8 +103,12 @@ repeat dvi = "dvipdfm"; ps2pdf = "" elseif this_arg == "-s" then dvi = ""; ps2pdf = "" + elseif this_arg == "-i" then + intermediate = 0 + elseif this_arg == "-1" then + passes = 1 elseif this_arg == "-f" then - tex = "etex"; dvi = "dvips"; ps2pdf = "ps2pdf" + tex = "etex"; dvi = "dvips"; ps2pdf = "ps2pdf"; intermediate = 1; passes = 2 else filename = this_arg if filename ~= "" and string.sub(filename, -4, -1) == ".tex" then @@ -106,24 +119,27 @@ repeat else print("Processing ".. filename .. ".tex.") os.remove( filename .. ".mx2" ) - if (os.execute(tex .. " " .. filename) == 0) and - (os.execute(musixflx .. " " .. filename) == 0) and + if (passes == 1 or os.execute(tex .. " " .. filename) == 0) and + (passes == 1 or os.execute(musixflx .. " " .. filename) == 0) and (os.execute(tex .. " " .. filename) == 0) and ((tex ~= "latex" and tex ~= "pdflatex") or (os.execute(tex .. " " .. filename) == 0)) and (dvi == "" or (os.execute(dvi .. " " .. filename) == 0)) and (ps2pdf == "" or (os.execute(ps2pdf .. " " .. filename .. ".ps") == 0) ) - then -- clean-up: - os.remove( filename .. ".mx1" ) - os.remove( filename .. ".mx2" ) - if dvi ~= "" then - os.remove( filename .. ".dvi" ) - end + then if ps2pdf ~= "" then print(filename .. ".pdf generated by " .. ps2pdf .. ".") - os.remove( filename .. ".ps" ) end - print("") + if intermediate == 1 then -- clean-up: + os.remove( filename .. ".mx1" ) + os.remove( filename .. ".mx2" ) + if dvi ~= "" then + os.remove( filename .. ".dvi" ) + end + if ps2pdf ~= "" then + os.remove( filename .. ".ps" ) + end + end else print("Musixtex processing of " .. filename .. ".tex fails.\n") exit_code = 2 |