diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-10 23:19:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-10 23:19:38 +0000 |
commit | 99e1b8c2020d443341a08f20f77dda1392366246 (patch) | |
tree | 94327a0121a8273ac6bf693cb18c9f68fa4256fe /Master/texmf-dist/scripts/musixtex | |
parent | 236222daf66574317ed37f1a93119fd2f44d68bf (diff) |
musixtex (7jun16)
git-svn-id: svn://tug.org/texlive/trunk@41352 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/musixtex')
-rwxr-xr-x | Master/texmf-dist/scripts/musixtex/musixtex.lua | 97 |
1 files changed, 64 insertions, 33 deletions
diff --git a/Master/texmf-dist/scripts/musixtex/musixtex.lua b/Master/texmf-dist/scripts/musixtex/musixtex.lua index 041eff342ba..5b27394b213 100755 --- a/Master/texmf-dist/scripts/musixtex/musixtex.lua +++ b/Master/texmf-dist/scripts/musixtex/musixtex.lua @@ -1,6 +1,6 @@ #!/usr/bin/env texlua -VERSION = "0.16c" +VERSION = "0.16e" --[[ musixtex.lua: processes MusiXTeX files using prepmx and/or pmxab and/or @@ -29,6 +29,12 @@ VERSION = "0.16c" ChangeLog: + version 0.16e 2016-03-02 DL + missing version information (caused by batchmode in 0.16c) fixed + + version 0.16d 2016-03-02 RDT + filename argument in autosp failure message fixed + version 0.16c 2016-02-24 RDT -interaction batchmode for -q report_error reports only the first error @@ -176,7 +182,7 @@ local dvips = "dvips -e0" function defaults() prepmx = "prepmx" pmx = "pmxab" - tex = "etex" + tex = "etex" musixflx = "musixflx" dvi = dvips ps2pdf = "ps2pdf" @@ -385,7 +391,7 @@ function preprocess(basename,extension) if execute ("autosp " .. basename .. ".aspc" ) == 0 then extension = "tex" else - print ("!! autosp preprocessing of " .. filename .. " fails.") + print ("!! autosp preprocessing of " .. basename .. ".aspc fails.") exit_code = exit_code+1 return end @@ -447,59 +453,80 @@ function tex_process(tex,basename,extension) end end --- Extracting version and path information from tempname. --- The targets below rely on the exact output format used by various --- programs and TeX files. -targets = { -mtxtex = "%(([^(]+mtx%.tex)%s*$", -mtxlatex = "%(([^(]+mtxlatex%.sty)", -mtxLaTeX = ".*mtxLaTeX.*", -pmxtex = "%(([^(]+pmx%.tex)", -musixtex = "%(([^(]+musixtex%.tex)", -musixltx = "%(([^(]+musixltx%.tex)", -musixlyr = "%(([^(]+musixlyr%.tex)", +---- Report version information on musixtex.log + +-- File names and message signatures to be looked for in a TeX log file. +logtargets = { +mtxtex = {"mtx%.tex","mtxTeX"}, +mtxlatex = {"mtxlatex%.sty","mtxLaTeX"}, +pmxtex = {"pmx%.tex","PMX"}, +musixtex = {"musixtex%.tex","MusiXTeX"}, +musixltx = {"musixltx%.tex","MusiXLaTeX"}, +musixlyr = {"musixlyr%.tex","MusiXLYR"} +} + +-- Signatures of messages displayed on standard output by programs +capturetargets = { MTx = "This is (M%-Tx.->)", PMX = "This is (PMX[^\n]+)", pdftex = "This is (pdfTeX[^\n]+)", musixflx = "Musixflx%S+", autosp = "This is autosp.*$", -index = "autosp,MTx,mtxtex,mtxlatex,mtxLaTeX,PMX,pmxtex,".. - "musixtex,musixltx,musixlyr,musixflx,pdftex" +index = "autosp,MTx,PMX,musixflx,pdftex" } -extra_line = { mtxtex=true, musixtex=true, musixltx=true, pmxtex=true, - musixlyr=true } +function report_texfiles(logname) + local log = logname and io.open(logname) + if not log then return end + local lines = + {"--- TeX files actually included according to "..logname.." ---"} + log = log:read"*a" +-- The following pattern matches filenames input by TeX, even if +-- interrupted by a line break. It may include the first word of +-- an \immediate\write10 message emitted by the file. + for pos,filename in log:gmatch"%(()(%.?[/]%a[%-/%.%w\n]+)" do + local hit + repeat + local oldfilename = filename + filename = oldfilename:match"[^\n]+" -- up to next line break + hit = io.open(filename) -- success if the file exists + if hit then break end + filename = oldfilename:gsub("\n","",1) -- remove line break + until filename==oldfilename + if hit then + for target,sig in pairs(logtargets) do + if filename:match(sig[1]) then + local i,j = log:find(sig[2].."[^\n]+",pos) + if j then lines[#lines+1] = filename.."\n "..log:sub(i,j) end + end + end + end + end + return table.concat(lines,'\n').."\n" +end function report_versions(tempname) if not tempname then return end -- only available with -q local logs = io.open(tempname) if not logs then - print ("No version information: could not open "..tempname) + musixlog:write ("No version information: could not open "..tempname) return end local versions = {} - local extra - musixlog:write("--- Packages actually used according to ".. - tempname.." ---\n") + musixlog:write("--- Programs actually executed according to "..tempname.." ---\n") for line in logs:lines() do - if extra then - versions[extra] = versions[extra] .. "\n " ..line - extra = false - else for target, pattern in pairs(targets) do + for target in capturetargets.index:gmatch"[^,]+" do if not versions[target] then - local found = line:match(pattern) + local found = line:match(capturetargets[target]) if found then - extra = extra_line[target] and target versions[target] = found + musixlog:write(found,"\n") end end - end end + end end logs:close() - for target in targets.index:gmatch"[^,]+" do if versions[target] then - if target=="mtxLaTeX" then musixlog:write" " end - musixlog:write(versions[target],"\n") - end end + return end ------------------------------------------------------------------------ @@ -519,6 +546,9 @@ repeat basename, extension = find_file(this_arg) -- nil,nil if not found extension = preprocess(basename,extension) tex_process(tex,basename,extension) + if io.open(basename..".log") then -- to be printed later + versions = report_texfiles(basename..".log") + end if basename and cleanup then remove("pmxaerr.dat") for ext in ("mx1,mx2,dvi,ps,idx,log,ilg,pml"):gmatch"[^,]+" do @@ -531,6 +561,7 @@ repeat narg = narg+1 until narg > #arg +musixlog:write(versions) report_versions(tempname) musixlog:close() os.exit( exit_code ) |