diff options
author | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-28 22:57:04 +0000 |
---|---|---|
committer | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-28 22:57:04 +0000 |
commit | 3f188c7493724d0cf0660657c90ff9be76d29ddb (patch) | |
tree | 65d4f730463ab70db723009cc976047649fe49a5 /Master/texmf-dist/scripts/context | |
parent | 9cc6cda737c19f4ca2e6af81ed487ae7e51bdbe6 (diff) |
ConTeXt 2012.05.29 00:12
git-svn-id: svn://tug.org/texlive/trunk@26706 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context')
4 files changed, 153 insertions, 26 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua index bbf47513354..fbcb251b1f2 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua @@ -157,7 +157,7 @@ function scripts.patterns.load(path,name,mnemonic,ignored) local hyphenations, patterns, comment, stripset = "", "", "", "" local splitpatternsnew, splithyphenationsnew = { }, { } local splitpatternsold, splithyphenationsold = { }, { } - local usedpatterncharacters, usedhyphenationcharacters = { }, { } + local usedpatterncharactersnew, usedhyphenationcharactersnew = { }, { } if lfs.isfile(patfile) then report("using txt files %s.[hyp|pat|lic].txt",name) comment, patterns, hyphenations = io.loaddata(licfile) or "", io.loaddata(patfile) or "", io.loaddata(hypfile) or "" @@ -258,7 +258,7 @@ function scripts.patterns.load(path,name,mnemonic,ignored) if not cdb then report("no entry in chardata for character %s (0x%04X)",char(b),b) else - local ct = cd[b].category + local ct = cdb.category if ct == "lu" or ct == "ll" then used[char(b)] = true elseif ct == "nd" then @@ -272,10 +272,10 @@ function scripts.patterns.load(path,name,mnemonic,ignored) end end end - return used + return used end - usedpatterncharacters = check(splitpatternsnew,byte(".")) - usedhyphenationcharacters = check(splithyphenationsnew,byte("-")) + usedpatterncharactersnew = check(splitpatternsnew,byte(".")) + usedhyphenationcharactersnew = check(splithyphenationsnew,byte("-")) for k, v in next, stripped do report("entries that contain character %s (0x%04X) have been omitted",char(k),k) end @@ -334,7 +334,7 @@ function scripts.patterns.load(path,name,mnemonic,ignored) -- discard elseif used[line] then -- discard - repo("discarding duplicate pattern: %s",line) + report("discarding duplicate pattern: %s",line) else used[line] = true collected[#collected+1] = line @@ -350,16 +350,36 @@ function scripts.patterns.load(path,name,mnemonic,ignored) if not okay then report("no valid file %s.*",name) end - return okay, splitpatternsnew, splithyphenationsnew, splitpatternsold, splithyphenationsold, comment, stripset, usedpatterncharacters, usedhyphenationcharacters + + local function getused(t) + local u = { } + for k, v in next, t do + if ignored and ignored[k] then + elseif replaced_whatever[k] then + else + u[k] = v + end + end + return u + end + local usedpatterncharactersold = getused(usedpatterncharactersnew) + local usedhyphenationcharactersold = getused(usedhyphenationcharactersnew) + + return okay, + splitpatternsnew, splithyphenationsnew, splitpatternsold, splithyphenationsold, comment, stripset, + usedpatterncharactersnew, usedhyphenationcharactersnew, usedpatterncharactersold, usedhyphenationcharactersold end -function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenationsnew,patternsold,hyphenationsold,comment,stripped,pused,hused,ignored) +function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenationsnew,patternsold,hyphenationsold,comment,stripped, + pusednew,husednew,pusedold,husedold,ignored) local nofpatternsnew, nofhyphenationsnew = #patternsnew, #hyphenationsnew local nofpatternsold, nofhyphenationsold = #patternsold, #hyphenationsold report("language %s has %s old and %s new patterns and %s old and %s new exceptions",mnemonic,nofpatternsold,nofpatternsnew,nofhyphenationsold,nofhyphenationsnew) if mnemonic ~= "??" then - local pu = concat(table.sortedkeys(pused), " ") - local hu = concat(table.sortedkeys(hused), " ") + local punew = concat(table.sortedkeys(pusednew), " ") + local hunew = concat(table.sortedkeys(husednew), " ") + local puold = concat(table.sortedkeys(pusedold), " ") + local huold = concat(table.sortedkeys(husedold), " ") local rmefile = file.join(destination,"lang-"..mnemonic..".rme") local patfile = file.join(destination,"lang-"..mnemonic..".pat") @@ -367,7 +387,7 @@ function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenation local luafile = file.join(destination,"lang-"..mnemonic..".lua") -- suffix might change to llg local topline = "% generated by mtxrun --script pattern --convert" - local banner = "% for comment and copyright, see " .. rmefile + local banner = "% for comment and copyright, see " .. file.basename(rmefile) report("saving language data for %s",mnemonic) if not comment or comment == "" then comment = "% no comment" end if not type(destination) == "string" then destination = "." end @@ -391,7 +411,7 @@ function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenation patterndata = { n = nofpatternsnew, data = concat(patternsnew," ") or nil, - characters = concat(table.sortedkeys(pused),""), + characters = concat(table.sortedkeys(pusednew),""), minhyphenmin = 1, -- determined by pattern author minhyphenmax = 1, -- determined by pattern author } @@ -404,7 +424,7 @@ function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenation hyphenationdata = { n = nofhyphenationsnew, data = concat(hyphenationsnew," "), - characters = concat(table.sortedkeys(hused),""), + characters = concat(table.sortedkeys(husednew),""), } else hyphenationdata = { @@ -427,8 +447,8 @@ function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenation os.remove(luafile) io.savedata(rmefile,format("%s\n\n%s",topline,comment)) - io.savedata(patfile,format("%s\n\n%s\n\n%% used: %s\n\n\\patterns{\n%s}",topline,banner,pu,concat(patternsold,"\n"))) - io.savedata(hypfile,format("%s\n\n%s\n\n%% used: %s\n\n\\hyphenation{\n%s}",topline,banner,hu,concat(hyphenationsold,"\n"))) + io.savedata(patfile,format("%s\n\n%s\n\n%% used: %s\n\n\\patterns{\n%s}",topline,banner,puold,concat(patternsold,"\n"))) + io.savedata(hypfile,format("%s\n\n%s\n\n%% used: %s\n\n\\hyphenation{\n%s}",topline,banner,huold,concat(hyphenationsold,"\n"))) io.savedata(luafile,table.serialize(data,true)) end end @@ -475,9 +495,11 @@ function scripts.patterns.convert() local mnemonic, name, ignored = v[1], v[2], v[4] if not only or only[mnemonic] then report("converting language %s, file %s", mnemonic, name) - local okay, patternsnew, hyphenationsnew, patternsold, hyphenationsold, comment, stripped, pused, hused = scripts.patterns.load(path,name,mnemonic,ignored) + local okay, patternsnew, hyphenationsnew, patternsold, hyphenationsold, comment, stripped, + pusednew, husednew, pusedold, husedold = scripts.patterns.load(path,name,mnemonic,ignored) if okay then - scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenationsnew,patternsold,hyphenationsold,comment,stripped,pused,hused,ignored) + scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenationsnew,patternsold,hyphenationsold,comment,stripped, + pusednew,husednew,pusedold,husedold,ignored) else report("convertion aborted due to error(s)") end diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua index 37ca30d8c1d..d2f7e408f0d 100755 --- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua +++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua @@ -1126,8 +1126,39 @@ local lpeg = require("lpeg") local report = texio and texio.write_nl or print - - +-- local lpmatch = lpeg.match +-- local lpprint = lpeg.print +-- local lpp = lpeg.P +-- local lpr = lpeg.R +-- local lps = lpeg.S +-- local lpc = lpeg.C +-- local lpb = lpeg.B +-- local lpv = lpeg.V +-- local lpcf = lpeg.Cf +-- local lpcb = lpeg.Cb +-- local lpcg = lpeg.Cg +-- local lpct = lpeg.Ct +-- local lpcs = lpeg.Cs +-- local lpcc = lpeg.Cc +-- local lpcmt = lpeg.Cmt +-- local lpcarg = lpeg.Carg + +-- function lpeg.match(l,...) report("LPEG MATCH") lpprint(l) return lpmatch(l,...) end + +-- function lpeg.P (l) local p = lpp (l) report("LPEG P =") lpprint(l) return p end +-- function lpeg.R (l) local p = lpr (l) report("LPEG R =") lpprint(l) return p end +-- function lpeg.S (l) local p = lps (l) report("LPEG S =") lpprint(l) return p end +-- function lpeg.C (l) local p = lpc (l) report("LPEG C =") lpprint(l) return p end +-- function lpeg.B (l) local p = lpb (l) report("LPEG B =") lpprint(l) return p end +-- function lpeg.V (l) local p = lpv (l) report("LPEG V =") lpprint(l) return p end +-- function lpeg.Cf (l) local p = lpcf (l) report("LPEG Cf =") lpprint(l) return p end +-- function lpeg.Cb (l) local p = lpcb (l) report("LPEG Cb =") lpprint(l) return p end +-- function lpeg.Cg (l) local p = lpcg (l) report("LPEG Cg =") lpprint(l) return p end +-- function lpeg.Ct (l) local p = lpct (l) report("LPEG Ct =") lpprint(l) return p end +-- function lpeg.Cs (l) local p = lpcs (l) report("LPEG Cs =") lpprint(l) return p end +-- function lpeg.Cc (l) local p = lpcc (l) report("LPEG Cc =") lpprint(l) return p end +-- function lpeg.Cmt (l) local p = lpcmt (l) report("LPEG Cmt =") lpprint(l) return p end +-- function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end local type = type local byte, char, gmatch = string.byte, string.char, string.gmatch @@ -2696,8 +2727,12 @@ local function basename(name) return match(name,"^.+[/\\](.-)$") or name end +-- local function nameonly(name) +-- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +-- end + local function nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$","")) end local function extname(name,default) diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua index 37ca30d8c1d..d2f7e408f0d 100644 --- a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua +++ b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua @@ -1126,8 +1126,39 @@ local lpeg = require("lpeg") local report = texio and texio.write_nl or print - - +-- local lpmatch = lpeg.match +-- local lpprint = lpeg.print +-- local lpp = lpeg.P +-- local lpr = lpeg.R +-- local lps = lpeg.S +-- local lpc = lpeg.C +-- local lpb = lpeg.B +-- local lpv = lpeg.V +-- local lpcf = lpeg.Cf +-- local lpcb = lpeg.Cb +-- local lpcg = lpeg.Cg +-- local lpct = lpeg.Ct +-- local lpcs = lpeg.Cs +-- local lpcc = lpeg.Cc +-- local lpcmt = lpeg.Cmt +-- local lpcarg = lpeg.Carg + +-- function lpeg.match(l,...) report("LPEG MATCH") lpprint(l) return lpmatch(l,...) end + +-- function lpeg.P (l) local p = lpp (l) report("LPEG P =") lpprint(l) return p end +-- function lpeg.R (l) local p = lpr (l) report("LPEG R =") lpprint(l) return p end +-- function lpeg.S (l) local p = lps (l) report("LPEG S =") lpprint(l) return p end +-- function lpeg.C (l) local p = lpc (l) report("LPEG C =") lpprint(l) return p end +-- function lpeg.B (l) local p = lpb (l) report("LPEG B =") lpprint(l) return p end +-- function lpeg.V (l) local p = lpv (l) report("LPEG V =") lpprint(l) return p end +-- function lpeg.Cf (l) local p = lpcf (l) report("LPEG Cf =") lpprint(l) return p end +-- function lpeg.Cb (l) local p = lpcb (l) report("LPEG Cb =") lpprint(l) return p end +-- function lpeg.Cg (l) local p = lpcg (l) report("LPEG Cg =") lpprint(l) return p end +-- function lpeg.Ct (l) local p = lpct (l) report("LPEG Ct =") lpprint(l) return p end +-- function lpeg.Cs (l) local p = lpcs (l) report("LPEG Cs =") lpprint(l) return p end +-- function lpeg.Cc (l) local p = lpcc (l) report("LPEG Cc =") lpprint(l) return p end +-- function lpeg.Cmt (l) local p = lpcmt (l) report("LPEG Cmt =") lpprint(l) return p end +-- function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end local type = type local byte, char, gmatch = string.byte, string.char, string.gmatch @@ -2696,8 +2727,12 @@ local function basename(name) return match(name,"^.+[/\\](.-)$") or name end +-- local function nameonly(name) +-- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +-- end + local function nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$","")) end local function extname(name,default) diff --git a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun index 37ca30d8c1d..d2f7e408f0d 100755 --- a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun +++ b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun @@ -1126,8 +1126,39 @@ local lpeg = require("lpeg") local report = texio and texio.write_nl or print - - +-- local lpmatch = lpeg.match +-- local lpprint = lpeg.print +-- local lpp = lpeg.P +-- local lpr = lpeg.R +-- local lps = lpeg.S +-- local lpc = lpeg.C +-- local lpb = lpeg.B +-- local lpv = lpeg.V +-- local lpcf = lpeg.Cf +-- local lpcb = lpeg.Cb +-- local lpcg = lpeg.Cg +-- local lpct = lpeg.Ct +-- local lpcs = lpeg.Cs +-- local lpcc = lpeg.Cc +-- local lpcmt = lpeg.Cmt +-- local lpcarg = lpeg.Carg + +-- function lpeg.match(l,...) report("LPEG MATCH") lpprint(l) return lpmatch(l,...) end + +-- function lpeg.P (l) local p = lpp (l) report("LPEG P =") lpprint(l) return p end +-- function lpeg.R (l) local p = lpr (l) report("LPEG R =") lpprint(l) return p end +-- function lpeg.S (l) local p = lps (l) report("LPEG S =") lpprint(l) return p end +-- function lpeg.C (l) local p = lpc (l) report("LPEG C =") lpprint(l) return p end +-- function lpeg.B (l) local p = lpb (l) report("LPEG B =") lpprint(l) return p end +-- function lpeg.V (l) local p = lpv (l) report("LPEG V =") lpprint(l) return p end +-- function lpeg.Cf (l) local p = lpcf (l) report("LPEG Cf =") lpprint(l) return p end +-- function lpeg.Cb (l) local p = lpcb (l) report("LPEG Cb =") lpprint(l) return p end +-- function lpeg.Cg (l) local p = lpcg (l) report("LPEG Cg =") lpprint(l) return p end +-- function lpeg.Ct (l) local p = lpct (l) report("LPEG Ct =") lpprint(l) return p end +-- function lpeg.Cs (l) local p = lpcs (l) report("LPEG Cs =") lpprint(l) return p end +-- function lpeg.Cc (l) local p = lpcc (l) report("LPEG Cc =") lpprint(l) return p end +-- function lpeg.Cmt (l) local p = lpcmt (l) report("LPEG Cmt =") lpprint(l) return p end +-- function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end local type = type local byte, char, gmatch = string.byte, string.char, string.gmatch @@ -2696,8 +2727,12 @@ local function basename(name) return match(name,"^.+[/\\](.-)$") or name end +-- local function nameonly(name) +-- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +-- end + local function nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$","")) end local function extname(name,default) |