From 522bdbb5f73e4f66367350d23a24f55eb9b917d9 Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 10 Oct 2013 15:40:25 +0300 Subject: beta 2013.10.10 14:36 --- scripts/context/lua/mtxrun.lua | 22 ++++++- scripts/context/stubs/mswin/mtxrun.lua | 22 ++++++- scripts/context/stubs/unix/mtxrun | 22 ++++++- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4113 -> 4103 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/data-tmp.lua | 26 ++++++++ tex/context/base/status-files.pdf | Bin 24546 -> 24545 bytes tex/context/base/status-lua.pdf | Bin 224675 -> 224749 bytes tex/context/base/supp-box.lua | 67 +++++++++++++++++++-- tex/context/base/supp-box.mkiv | 18 ++++-- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 12 files changed, 160 insertions(+), 23 deletions(-) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 0ddb7f65c..7f0818969 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -12893,7 +12893,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-tmp"] = package.loaded["data-tmp"] or true --- original size: 14615, stripped down to: 11208 +-- original size: 15532, stripped down to: 11648 if not modules then modules={} end modules ['data-tmp']={ version=1.100, @@ -13107,6 +13107,22 @@ function caches.getfirstreadablefile(filename,...) end return caches.setfirstwritablefile(filename,...) end +function caches.getfirstreadablefile_TEST_ME_FIRST(filename,...) + local fullname,path=caches.setfirstwritablefile(filename,...) + if is_readable(fullname) then + return fullname,path + end + local rd=getreadablepaths(...) + for i=1,#rd do + local path=rd[i] + local fullname=file.join(path,filename) + if is_readable(fullname) then + usedreadables[i]=true + return fullname,path + end + end + return fullname,path +end function caches.setfirstwritablefile(filename,...) local wr=getwritablepath(...) local fullname=file.join(wr,filename) @@ -16546,8 +16562,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 679533 --- stripped bytes : 240506 +-- original bytes : 680450 +-- stripped bytes : 240983 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 0ddb7f65c..7f0818969 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -12893,7 +12893,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-tmp"] = package.loaded["data-tmp"] or true --- original size: 14615, stripped down to: 11208 +-- original size: 15532, stripped down to: 11648 if not modules then modules={} end modules ['data-tmp']={ version=1.100, @@ -13107,6 +13107,22 @@ function caches.getfirstreadablefile(filename,...) end return caches.setfirstwritablefile(filename,...) end +function caches.getfirstreadablefile_TEST_ME_FIRST(filename,...) + local fullname,path=caches.setfirstwritablefile(filename,...) + if is_readable(fullname) then + return fullname,path + end + local rd=getreadablepaths(...) + for i=1,#rd do + local path=rd[i] + local fullname=file.join(path,filename) + if is_readable(fullname) then + usedreadables[i]=true + return fullname,path + end + end + return fullname,path +end function caches.setfirstwritablefile(filename,...) local wr=getwritablepath(...) local fullname=file.join(wr,filename) @@ -16546,8 +16562,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 679533 --- stripped bytes : 240506 +-- original bytes : 680450 +-- stripped bytes : 240983 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 0ddb7f65c..7f0818969 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -12893,7 +12893,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-tmp"] = package.loaded["data-tmp"] or true --- original size: 14615, stripped down to: 11208 +-- original size: 15532, stripped down to: 11648 if not modules then modules={} end modules ['data-tmp']={ version=1.100, @@ -13107,6 +13107,22 @@ function caches.getfirstreadablefile(filename,...) end return caches.setfirstwritablefile(filename,...) end +function caches.getfirstreadablefile_TEST_ME_FIRST(filename,...) + local fullname,path=caches.setfirstwritablefile(filename,...) + if is_readable(fullname) then + return fullname,path + end + local rd=getreadablepaths(...) + for i=1,#rd do + local path=rd[i] + local fullname=file.join(path,filename) + if is_readable(fullname) then + usedreadables[i]=true + return fullname,path + end + end + return fullname,path +end function caches.setfirstwritablefile(filename,...) local wr=getwritablepath(...) local fullname=file.join(wr,filename) @@ -16546,8 +16562,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 679533 --- stripped bytes : 240506 +-- original bytes : 680450 +-- stripped bytes : 240983 -- end library merge diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 83581f346..0ddf06fcb 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.10.09 10:36} +\newcontextversion{2013.10.10 14:36} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index bceaf1cf6..fa1889a43 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 223389efc..9d38f7801 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.10.09 10:36} +\edef\contextversion{2013.10.10 14:36} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/data-tmp.lua b/tex/context/base/data-tmp.lua index 5025a8a0a..3e109dcfe 100644 --- a/tex/context/base/data-tmp.lua +++ b/tex/context/base/data-tmp.lua @@ -250,6 +250,10 @@ end caches.getreadablepaths = getreadablepaths caches.getwritablepath = getwritablepath +-- this can be tricky as we can have a pre-generated format while at the same time +-- use e.g. a home path where we have updated file databases and so maybe we need +-- to check first if we do have a writable one + function caches.getfirstreadablefile(filename,...) local rd = getreadablepaths(...) for i=1,#rd do @@ -263,6 +267,28 @@ function caches.getfirstreadablefile(filename,...) return caches.setfirstwritablefile(filename,...) end +-- next time we have an issue, we can test this instead: + +function caches.getfirstreadablefile_TEST_ME_FIRST(filename,...) + -- check if we have already written once + local fullname, path = caches.setfirstwritablefile(filename,...) + if is_readable(fullname) then + return fullname, path -- , true + end + -- otherwise search for pregenerated + local rd = getreadablepaths(...) + for i=1,#rd do + local path = rd[i] + local fullname = file.join(path,filename) + if is_readable(fullname) then + usedreadables[i] = true + return fullname, path -- , false + end + end + -- else assume new written + return fullname, path -- , true +end + function caches.setfirstwritablefile(filename,...) local wr = getwritablepath(...) local fullname = file.join(wr,filename) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 3add679c9..3c3a057d6 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index b3a6c3f1f..5932a14ea 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/supp-box.lua b/tex/context/base/supp-box.lua index a8603ace3..bc0a7056e 100644 --- a/tex/context/base/supp-box.lua +++ b/tex/context/base/supp-box.lua @@ -10,8 +10,12 @@ if not modules then modules = { } end modules ['supp-box'] = { local report_hyphenation = logs.reporter("languages","hyphenation") -local tex, node = tex, node -local context, commands, nodes = context, commands, nodes +local tex = tex +local context = context +local commands = commands +local nodes = nodes + +local splitstring = string.split local nodecodes = nodes.nodecodes @@ -25,10 +29,10 @@ local new_penalty = nodes.pool.penalty local new_hlist = nodes.pool.hlist local new_glue = nodes.pool.glue -local free_node = node.free -local copy_list = node.copy_list -local copy_node = node.copy -local find_tail = node.tail +local free_node = nodes.free +local copy_list = nodes.copy_list +local copy_node = nodes.copy +local find_tail = nodes.tail local texsetbox = tex.setbox local texgetbox = tex.getbox @@ -117,6 +121,57 @@ end commands.applytochars = applytochars commands.applytowords = applytowords +local split_char = lpeg.Ct(lpeg.C(1)^0) +local split_word = lpeg.tsplitat(lpeg.patterns.space) +local split_line = lpeg.tsplitat(lpeg.patterns.eol) + +function commands.processsplit(str,command,how,spaced) + how = how or "word" + if how == "char" then + local words = lpeg.match(split_char,str) + for i=1,#words do + local word = words[i] + if word == " " then + if spaced then + context.space() + end + elseif command then + context[command](word) + else + context(word) + end + end + elseif how == "word" then + local words = lpeg.match(split_word,str) + for i=1,#words do + local word = words[i] + if spaced and i > 1 then + context.space() + end + if command then + context[command](word) + else + context(word) + end + end + elseif how == "line" then + local words = lpeg.match(split_line,str) + for i=1,#words do + local word = words[i] + if spaced and i > 1 then + context.par() + end + if command then + context[command](word) + else + context(word) + end + end + else + context(str) + end +end + function commands.vboxlisttohbox(original,target,inbetween) local current = texgetbox(original).list local head = nil diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index f78a8554c..ad35b525b 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -1346,11 +1346,11 @@ %D {processisolatedwords,processisolatedchars} %D %D \startbuffer -%D \processisolatedchars{some more words} \ruledhbox \par -%D \processisolatedchars{and some $x + y = z$ math} \ruledhbox \par +%D \processisolatedchars{some more words} \ruledhbox \par +%D \processisolatedchars{and some $x + y = z$ math} \ruledhbox \par %D \processisolatedchars{and a \hbox{$x + y = z$}} \ruledhbox \par -%D \processisolatedwords{some more words} \ruledhbox \par -%D \processisolatedwords{and some $x + y = z$ math} \ruledhbox \par +%D \processisolatedwords{some more words} \ruledhbox \par +%D \processisolatedwords{and some $x + y = z$ math} \ruledhbox \par %D \processisolatedwords{and a \hbox{$x + y = z$}} \ruledhbox \par %D \stopbuffer %D @@ -1379,7 +1379,15 @@ \let\processword\relax -%D The better variant: +\unexpanded\def\applytosplitstringchar#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","char")}} +\unexpanded\def\applytosplitstringword#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","word")}} +\unexpanded\def\applytosplitstringline#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","line")}} + +\unexpanded\def\applytosplitstringcharspaced#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","char",true)}} +\unexpanded\def\applytosplitstringwordspaced#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","word",true)}} +\unexpanded\def\applytosplitstringlinespaced#1#2{\dontleavehmode\ctxcommand{processsplit(\!!bs#2\!!es,"\strippedcsname#1","line",true)}} + +%D A variant: \unexpanded\def\applytocharacters#1% {\dontleavehmode diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0feb654b1..330e93690 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/09/13 10:36:35 +-- merge date : 10/10/13 14:36:18 do -- begin closure to overcome local limits and interference -- cgit v1.2.3