diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-05-27 12:37:50 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-05-27 12:37:50 +0200 |
commit | 32381f97e98465953bfde24b4436093e70fbe70f (patch) | |
tree | 1f585cf7af509e76c64aca108cecd23acd6fb437 /scripts/context/stubs | |
parent | bb8ae12f4f94189fd1540b201e2aea78f485de97 (diff) | |
download | context-32381f97e98465953bfde24b4436093e70fbe70f.tar.gz |
2023-05-27 12:16:00
Diffstat (limited to 'scripts/context/stubs')
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 53 | ||||
-rw-r--r-- | scripts/context/stubs/source/readme.txt | 80 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 53 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 53 |
4 files changed, 142 insertions, 97 deletions
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 27c2e6cb0..ad39c4579 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-zip"] = package.loaded["util-zip"] or true --- original size: 32353, stripped down to: 16001 +-- original size: 33051, stripped down to: 16324 if not modules then modules={} end modules ['util-zip']={ version=1.001, @@ -16301,8 +16301,10 @@ if xzip then closezip(zipf) end end - local function unzipdir(zipname,path,verbose) + local function unzipdir(zipname,path,verbose,collect,validate) if type(zipname)=="table" then + validate=zipname.validate + collect=zipname.collect verbose=zipname.verbose path=zipname.path zipname=zipname.zipname @@ -16323,34 +16325,47 @@ if xzip then local done=0 local steps=verbose=="steps" local time=steps and osclock() + if collect then + collect={} + else + collect=false + end for i=1,count do local l=list[i] local n=l.filename - local d=unzipfile(z,n) - if d then - local p=filejoin(path,n) - if mkdirs(dirname(p)) then - if steps then - total=total+#d - done=done+1 - if done>=step then - done=0 - logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time)) + if not validate or validate(n) then + local d=unzipfile(z,n) + if d then + local p=filejoin(path,n) + if mkdirs(dirname(p)) then + if steps then + total=total+#d + done=done+1 + if done>=step then + done=0 + logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time)) + end + elseif verbose then + logwriter(n) + end + savedata(p,d) + if collect then + collect[#collect+1]=p end - elseif verbose then - logwriter(n) end - savedata(p,d) + else + logwriter(format("problem with file %s",n)) end else - logwriter(format("problem with file %s",n)) end end if steps then logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time)) end closezipfile(z) - return true + if collect then + return collect + end else closezipfile(z) end @@ -26188,8 +26203,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.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-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1046208 --- stripped bytes : 415601 +-- original bytes : 1046906 +-- stripped bytes : 415976 -- end library merge diff --git a/scripts/context/stubs/source/readme.txt b/scripts/context/stubs/source/readme.txt index 72892ee2f..4eae76a1e 100644 --- a/scripts/context/stubs/source/readme.txt +++ b/scripts/context/stubs/source/readme.txt @@ -1,40 +1,40 @@ -Copyright: - -The originally 'runscript' program was written by in 2009 by T.M.Trzeciak and is -public domain. This derived mtxrun program is an adapted version by Hans Hagen and -Luigi Scarso. - -Comment: - -In ConTeXt MkIV we have two core scripts: luatools.lua and mtxrun.lua where the -second one is used to launch other scripts. The mtxrun.exe program calls luatex.exe. - -Normally a user will use a call like: - - mtxrun --script font --reload - -Here mtxrun is a lua script. In order to avoid the usage of a cmd file on windows this -runner will start texlua directly. In TeXlive a runner is added for each cmd file but -we don't want that overhead (and extra files). By using an exe we can call these -scripts in batch files without the need for using call. - -The mtxrun.exe file can be copied to a mtxrunjit.exe file in which case luajittex.exe -is called. - - mtxrunjit --script font --reload - -We also don't want to use other runners, like those that use kpse to locate the script -as this is exactly what mtxrun itself is doing already. Therefore the runscript program -is adapted to a more direct approach suitable for mtxrun. - -Compilation: - -with gcc (size optimized): - - gcc -Os -s -shared -o mtxrun.dll mtxrun_dll.c - gcc -Os -s -o mtxrun.exe mtxrun_exe.c -L./ -lmtxrun - -with tcc (ver. 0.9.24), extra small size - - tcc -shared -o runscript.dll runscript_dll.c - tcc -o runscript.exe runscript_exe.c runscript.def +Copyright:
+
+The originally 'runscript' program was written by in 2009 by T.M.Trzeciak and is
+public domain. This derived mtxrun program is an adapted version by Hans Hagen and
+Luigi Scarso.
+
+Comment:
+
+In ConTeXt MkIV we have two core scripts: luatools.lua and mtxrun.lua where the
+second one is used to launch other scripts. The mtxrun.exe program calls luatex.exe.
+
+Normally a user will use a call like:
+
+ mtxrun --script font --reload
+
+Here mtxrun is a lua script. In order to avoid the usage of a cmd file on windows this
+runner will start texlua directly. In TeXlive a runner is added for each cmd file but
+we don't want that overhead (and extra files). By using an exe we can call these
+scripts in batch files without the need for using call.
+
+The mtxrun.exe file can be copied to a mtxrunjit.exe file in which case luajittex.exe
+is called.
+
+ mtxrunjit --script font --reload
+
+We also don't want to use other runners, like those that use kpse to locate the script
+as this is exactly what mtxrun itself is doing already. Therefore the runscript program
+is adapted to a more direct approach suitable for mtxrun.
+
+Compilation:
+
+with gcc (size optimized):
+
+ gcc -Os -s -shared -o mtxrun.dll mtxrun_dll.c
+ gcc -Os -s -o mtxrun.exe mtxrun_exe.c -L./ -lmtxrun
+
+with tcc (ver. 0.9.24), extra small size
+
+ tcc -shared -o runscript.dll runscript_dll.c
+ tcc -o runscript.exe runscript_exe.c runscript.def
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 27c2e6cb0..ad39c4579 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-zip"] = package.loaded["util-zip"] or true --- original size: 32353, stripped down to: 16001 +-- original size: 33051, stripped down to: 16324 if not modules then modules={} end modules ['util-zip']={ version=1.001, @@ -16301,8 +16301,10 @@ if xzip then closezip(zipf) end end - local function unzipdir(zipname,path,verbose) + local function unzipdir(zipname,path,verbose,collect,validate) if type(zipname)=="table" then + validate=zipname.validate + collect=zipname.collect verbose=zipname.verbose path=zipname.path zipname=zipname.zipname @@ -16323,34 +16325,47 @@ if xzip then local done=0 local steps=verbose=="steps" local time=steps and osclock() + if collect then + collect={} + else + collect=false + end for i=1,count do local l=list[i] local n=l.filename - local d=unzipfile(z,n) - if d then - local p=filejoin(path,n) - if mkdirs(dirname(p)) then - if steps then - total=total+#d - done=done+1 - if done>=step then - done=0 - logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time)) + if not validate or validate(n) then + local d=unzipfile(z,n) + if d then + local p=filejoin(path,n) + if mkdirs(dirname(p)) then + if steps then + total=total+#d + done=done+1 + if done>=step then + done=0 + logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time)) + end + elseif verbose then + logwriter(n) + end + savedata(p,d) + if collect then + collect[#collect+1]=p end - elseif verbose then - logwriter(n) end - savedata(p,d) + else + logwriter(format("problem with file %s",n)) end else - logwriter(format("problem with file %s",n)) end end if steps then logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time)) end closezipfile(z) - return true + if collect then + return collect + end else closezipfile(z) end @@ -26188,8 +26203,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.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-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1046208 --- stripped bytes : 415601 +-- original bytes : 1046906 +-- stripped bytes : 415976 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 27c2e6cb0..ad39c4579 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-zip"] = package.loaded["util-zip"] or true --- original size: 32353, stripped down to: 16001 +-- original size: 33051, stripped down to: 16324 if not modules then modules={} end modules ['util-zip']={ version=1.001, @@ -16301,8 +16301,10 @@ if xzip then closezip(zipf) end end - local function unzipdir(zipname,path,verbose) + local function unzipdir(zipname,path,verbose,collect,validate) if type(zipname)=="table" then + validate=zipname.validate + collect=zipname.collect verbose=zipname.verbose path=zipname.path zipname=zipname.zipname @@ -16323,34 +16325,47 @@ if xzip then local done=0 local steps=verbose=="steps" local time=steps and osclock() + if collect then + collect={} + else + collect=false + end for i=1,count do local l=list[i] local n=l.filename - local d=unzipfile(z,n) - if d then - local p=filejoin(path,n) - if mkdirs(dirname(p)) then - if steps then - total=total+#d - done=done+1 - if done>=step then - done=0 - logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time)) + if not validate or validate(n) then + local d=unzipfile(z,n) + if d then + local p=filejoin(path,n) + if mkdirs(dirname(p)) then + if steps then + total=total+#d + done=done+1 + if done>=step then + done=0 + logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time)) + end + elseif verbose then + logwriter(n) + end + savedata(p,d) + if collect then + collect[#collect+1]=p end - elseif verbose then - logwriter(n) end - savedata(p,d) + else + logwriter(format("problem with file %s",n)) end else - logwriter(format("problem with file %s",n)) end end if steps then logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time)) end closezipfile(z) - return true + if collect then + return collect + end else closezipfile(z) end @@ -26188,8 +26203,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.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-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1046208 --- stripped bytes : 415601 +-- original bytes : 1046906 +-- stripped bytes : 415976 -- end library merge |