diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-09-19 19:21:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-09-19 19:21:00 +0200 |
commit | ec3453f29b8d1f76349e9d5d83ff42d2f3c4eb13 (patch) | |
tree | 43015ba823abf810d801b6ce6bab207e8b8faa7f | |
parent | 0927bc1899f7d5169ef3fb0f3ca42902f36c8728 (diff) | |
download | context-ec3453f29b8d1f76349e9d5d83ff42d2f3c4eb13.tar.gz |
beta 2013.09.19 19:21
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 47 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 47 | ||||
-rwxr-xr-x | scripts/context/stubs/unix/mtxrun | 47 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4112 -> 4109 bytes | |||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24778 -> 24775 bytes | |||
-rw-r--r-- | tex/context/base/util-tab.lua | 48 |
6 files changed, 133 insertions, 56 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 69293450c..f1edc5b0d 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -5285,7 +5285,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-tab"] = package.loaded["util-tab"] or true --- original size: 22787, stripped down to: 15432 +-- original size: 23803, stripped down to: 15979 if not modules then modules={} end modules ['util-tab']={ version=1.001, @@ -5512,10 +5512,13 @@ local f_hashed_string=formatters["[%q]=%q,"] local f_hashed_number=formatters["[%q]=%s,"] local f_hashed_boolean=formatters["[%q]=%l,"] local f_hashed_table=formatters["[%q]="] -local f_indexed_string=formatters["%q,"] -local f_indexed_number=formatters["%s,"] -local f_indexed_boolean=formatters["%l,"] -function table.fastserialize(t,prefix) +local f_indexed_string=formatters["[%s]=%q,"] +local f_indexed_number=formatters["[%s]=%s,"] +local f_indexed_boolean=formatters["[%s]=%l,"] +local f_ordered_string=formatters["%q,"] +local f_ordered_number=formatters["%s,"] +local f_ordered_boolean=formatters["%l,"] +function table.fastserialize(t,prefix) local r={ prefix or "return" } local m=1 local function fastserialize(t,outer) @@ -5523,22 +5526,36 @@ function table.fastserialize(t,prefix) m=m+1 r[m]="{" if n>0 then - for i=1,n do + for i=0,n do local v=t[i] local tv=type(v) if tv=="string" then - m=m+1 r[m]=f_indexed_string(v) + m=m+1 r[m]=f_ordered_string(v) elseif tv=="number" then - m=m+1 r[m]=f_indexed_number(v) + m=m+1 r[m]=f_ordered_number(v) elseif tv=="table" then fastserialize(v) elseif tv=="boolean" then - m=m+1 r[m]=f_indexed_boolean(v) + m=m+1 r[m]=f_ordered_boolean(v) end end - else - for k,v in next,t do - local tv=type(v) + end + for k,v in next,t do + local tk=type(k) + local tv=type(v) + if tk=="number" then + if k>n or k<0 then + if tv=="string" then + m=m+1 r[m]=f_indexed_string(k,v) + elseif tv=="number" then + m=m+1 r[m]=f_indexed_number(k,v) + elseif tv=="table" then + fastserialize(v) + elseif tv=="boolean" then + m=m+1 r[m]=f_indexed_boolean(k,v) + end + end + else if tv=="string" then m=m+1 r[m]=f_hashed_string(k,v) elseif tv=="number" then @@ -5689,7 +5706,7 @@ local f_table_direct=formatters["{"] local f_table_entry=formatters["[%q]={"] local f_table_finish=formatters["}"] local spaces=utilities.strings.newrepeater(" ") -local serialize=table.serialize +local serialize=table.serialize function table.serialize(root,name,specification) if type(specification)=="table" then return serialize(root,name,specification) @@ -16521,8 +16538,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 : 678007 --- stripped bytes : 239807 +-- original bytes : 679023 +-- stripped bytes : 240276 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 69293450c..f1edc5b0d 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -5285,7 +5285,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-tab"] = package.loaded["util-tab"] or true --- original size: 22787, stripped down to: 15432 +-- original size: 23803, stripped down to: 15979 if not modules then modules={} end modules ['util-tab']={ version=1.001, @@ -5512,10 +5512,13 @@ local f_hashed_string=formatters["[%q]=%q,"] local f_hashed_number=formatters["[%q]=%s,"] local f_hashed_boolean=formatters["[%q]=%l,"] local f_hashed_table=formatters["[%q]="] -local f_indexed_string=formatters["%q,"] -local f_indexed_number=formatters["%s,"] -local f_indexed_boolean=formatters["%l,"] -function table.fastserialize(t,prefix) +local f_indexed_string=formatters["[%s]=%q,"] +local f_indexed_number=formatters["[%s]=%s,"] +local f_indexed_boolean=formatters["[%s]=%l,"] +local f_ordered_string=formatters["%q,"] +local f_ordered_number=formatters["%s,"] +local f_ordered_boolean=formatters["%l,"] +function table.fastserialize(t,prefix) local r={ prefix or "return" } local m=1 local function fastserialize(t,outer) @@ -5523,22 +5526,36 @@ function table.fastserialize(t,prefix) m=m+1 r[m]="{" if n>0 then - for i=1,n do + for i=0,n do local v=t[i] local tv=type(v) if tv=="string" then - m=m+1 r[m]=f_indexed_string(v) + m=m+1 r[m]=f_ordered_string(v) elseif tv=="number" then - m=m+1 r[m]=f_indexed_number(v) + m=m+1 r[m]=f_ordered_number(v) elseif tv=="table" then fastserialize(v) elseif tv=="boolean" then - m=m+1 r[m]=f_indexed_boolean(v) + m=m+1 r[m]=f_ordered_boolean(v) end end - else - for k,v in next,t do - local tv=type(v) + end + for k,v in next,t do + local tk=type(k) + local tv=type(v) + if tk=="number" then + if k>n or k<0 then + if tv=="string" then + m=m+1 r[m]=f_indexed_string(k,v) + elseif tv=="number" then + m=m+1 r[m]=f_indexed_number(k,v) + elseif tv=="table" then + fastserialize(v) + elseif tv=="boolean" then + m=m+1 r[m]=f_indexed_boolean(k,v) + end + end + else if tv=="string" then m=m+1 r[m]=f_hashed_string(k,v) elseif tv=="number" then @@ -5689,7 +5706,7 @@ local f_table_direct=formatters["{"] local f_table_entry=formatters["[%q]={"] local f_table_finish=formatters["}"] local spaces=utilities.strings.newrepeater(" ") -local serialize=table.serialize +local serialize=table.serialize function table.serialize(root,name,specification) if type(specification)=="table" then return serialize(root,name,specification) @@ -16521,8 +16538,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 : 678007 --- stripped bytes : 239807 +-- original bytes : 679023 +-- stripped bytes : 240276 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 69293450c..f1edc5b0d 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -5285,7 +5285,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-tab"] = package.loaded["util-tab"] or true --- original size: 22787, stripped down to: 15432 +-- original size: 23803, stripped down to: 15979 if not modules then modules={} end modules ['util-tab']={ version=1.001, @@ -5512,10 +5512,13 @@ local f_hashed_string=formatters["[%q]=%q,"] local f_hashed_number=formatters["[%q]=%s,"] local f_hashed_boolean=formatters["[%q]=%l,"] local f_hashed_table=formatters["[%q]="] -local f_indexed_string=formatters["%q,"] -local f_indexed_number=formatters["%s,"] -local f_indexed_boolean=formatters["%l,"] -function table.fastserialize(t,prefix) +local f_indexed_string=formatters["[%s]=%q,"] +local f_indexed_number=formatters["[%s]=%s,"] +local f_indexed_boolean=formatters["[%s]=%l,"] +local f_ordered_string=formatters["%q,"] +local f_ordered_number=formatters["%s,"] +local f_ordered_boolean=formatters["%l,"] +function table.fastserialize(t,prefix) local r={ prefix or "return" } local m=1 local function fastserialize(t,outer) @@ -5523,22 +5526,36 @@ function table.fastserialize(t,prefix) m=m+1 r[m]="{" if n>0 then - for i=1,n do + for i=0,n do local v=t[i] local tv=type(v) if tv=="string" then - m=m+1 r[m]=f_indexed_string(v) + m=m+1 r[m]=f_ordered_string(v) elseif tv=="number" then - m=m+1 r[m]=f_indexed_number(v) + m=m+1 r[m]=f_ordered_number(v) elseif tv=="table" then fastserialize(v) elseif tv=="boolean" then - m=m+1 r[m]=f_indexed_boolean(v) + m=m+1 r[m]=f_ordered_boolean(v) end end - else - for k,v in next,t do - local tv=type(v) + end + for k,v in next,t do + local tk=type(k) + local tv=type(v) + if tk=="number" then + if k>n or k<0 then + if tv=="string" then + m=m+1 r[m]=f_indexed_string(k,v) + elseif tv=="number" then + m=m+1 r[m]=f_indexed_number(k,v) + elseif tv=="table" then + fastserialize(v) + elseif tv=="boolean" then + m=m+1 r[m]=f_indexed_boolean(k,v) + end + end + else if tv=="string" then m=m+1 r[m]=f_hashed_string(k,v) elseif tv=="number" then @@ -5689,7 +5706,7 @@ local f_table_direct=formatters["{"] local f_table_entry=formatters["[%q]={"] local f_table_finish=formatters["}"] local spaces=utilities.strings.newrepeater(" ") -local serialize=table.serialize +local serialize=table.serialize function table.serialize(root,name,specification) if type(specification)=="table" then return serialize(root,name,specification) @@ -16521,8 +16538,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 : 678007 --- stripped bytes : 239807 +-- original bytes : 679023 +-- stripped bytes : 240276 -- end library merge diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 8aca2aa54..bb4f0a3c8 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 26abecfb3..f161d6fe9 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/util-tab.lua b/tex/context/base/util-tab.lua index 06c374c67..f04e2a300 100644 --- a/tex/context/base/util-tab.lua +++ b/tex/context/base/util-tab.lua @@ -301,11 +301,19 @@ local f_hashed_number = formatters["[%q]=%s,"] local f_hashed_boolean = formatters["[%q]=%l,"] local f_hashed_table = formatters["[%q]="] -local f_indexed_string = formatters["%q,"] -local f_indexed_number = formatters["%s,"] -local f_indexed_boolean = formatters["%l,"] +local f_indexed_string = formatters["[%s]=%q,"] +local f_indexed_number = formatters["[%s]=%s,"] +local f_indexed_boolean = formatters["[%s]=%l,"] -function table.fastserialize(t,prefix) -- so prefix should contain the = | not sorted +local f_ordered_string = formatters["%q,"] +local f_ordered_number = formatters["%s,"] +local f_ordered_boolean = formatters["%l,"] + +function table.fastserialize(t,prefix) + + -- prefix should contain the = + -- not sorted + -- only number and string indices (currently) local r = { prefix or "return" } local m = 1 @@ -315,22 +323,36 @@ function table.fastserialize(t,prefix) -- so prefix should contain the = | not s m = m + 1 r[m] = "{" if n > 0 then - for i=1,n do + for i=0,n do local v = t[i] local tv = type(v) if tv == "string" then - m = m + 1 r[m] = f_indexed_string(v) + m = m + 1 r[m] = f_ordered_string(v) elseif tv == "number" then - m = m + 1 r[m] = f_indexed_number(v) + m = m + 1 r[m] = f_ordered_number(v) elseif tv == "table" then fastserialize(v) elseif tv == "boolean" then - m = m + 1 r[m] = f_indexed_boolean(v) + m = m + 1 r[m] = f_ordered_boolean(v) end end - else - for k, v in next, t do - local tv = type(v) + end + for k, v in next, t do + local tk = type(k) + local tv = type(v) + if tk == "number" then + if k > n or k < 0 then + if tv == "string" then + m = m + 1 r[m] = f_indexed_string(k,v) + elseif tv == "number" then + m = m + 1 r[m] = f_indexed_number(k,v) + elseif tv == "table" then + fastserialize(v) + elseif tv == "boolean" then + m = m + 1 r[m] = f_indexed_boolean(k,v) + end + end + else if tv == "string" then m = m + 1 r[m] = f_hashed_string(k,v) elseif tv == "number" then @@ -520,6 +542,10 @@ local spaces = utilities.strings.newrepeater(" ") local serialize = table.serialize -- the extensive one, the one we started with +-- there is still room for optimization: index run, key run, but i need to check with the +-- latest lua for the value of #n (with holes) .. anyway for tracing purposes we want +-- indices / keys being sorted, so it will never be real fast + function table.serialize(root,name,specification) if type(specification) == "table" then |