diff options
102 files changed, 1084 insertions, 493 deletions
diff --git a/context/data/scite/context.properties b/context/data/scite/context.properties index 87d05dcde..c75d1227e 100644 --- a/context/data/scite/context.properties +++ b/context/data/scite/context.properties @@ -68,8 +68,8 @@ file.patterns.lua=*.lua;*.luc;*.cld;*.tuc;*.luj filter.lua=Lua MkIV|$(file.patterns.lua)| lexer.$(file.patterns.lua)=lua -command.compile.$(file.patterns.lua)=mtxrun.cmd --script "$(FileNameExt)" -command.go.$(file.patterns.lua)=mtxrun.cmd --script "$(FileNameExt)" +command.compile.$(file.patterns.lua)=mtxrun --script "$(FileNameExt)" +command.go.$(file.patterns.lua)=mtxrun --script "$(FileNameExt)" # Commands: some scripts @@ -94,7 +94,7 @@ name.metafun.console=$(name.context.console) name.example.console=$(name.context.console) if PLAT_WIN - name.context.mtxrun=mtxrun.cmd --autogenerate + name.context.mtxrun=mtxrun --autogenerate if PLAT_GTK name.context.mtxrun=mtxrun --autogenerate diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua index 692213b09..6feb7a9c5 100644 --- a/scripts/context/lua/luatools.lua +++ b/scripts/context/lua/luatools.lua @@ -1780,6 +1780,7 @@ function os.currentplatform(name,default) platform = "linux" end elseif name == "macosx" then + local architecture = os.resultof("echo $HOSTTYPE") if find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then @@ -1881,8 +1882,8 @@ function file.nameonly(name) return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.extname(name) - return match(name,"^.+%.([^/\\]-)$") or "" +function file.extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end file.suffix = file.extname @@ -3757,7 +3758,7 @@ end if arg then - -- new, reconstruct quoted snippets (maybe better just remnove the " then and add them later) + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) local newarg, instring = { }, false for index, argument in ipairs(arg) do @@ -4077,6 +4078,9 @@ if not modules then modules = { } end modules ['luat-log'] = { -- this is old code that needs an overhaul +--~ io.stdout:setvbuf("no") +--~ io.stderr:setvbuf("no") + local write_nl, write, format = texio.write_nl or print, texio.write or io.write, string.format local texcount = tex and tex.count @@ -4158,27 +4162,49 @@ function logs.tex.line(fmt,...) -- new end end +--~ function logs.tex.start_page_number() +--~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +--~ if real > 0 then +--~ if user > 0 then +--~ if sub > 0 then +--~ write(format("[%s.%s.%s",real,user,sub)) +--~ else +--~ write(format("[%s.%s",real,user)) +--~ end +--~ else +--~ write(format("[%s",real)) +--~ end +--~ else +--~ write("[-") +--~ end +--~ end + +--~ function logs.tex.stop_page_number() +--~ write("]") +--~ end + +local real, user, sub + function logs.tex.start_page_number() - local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.tex.stop_page_number() if real > 0 then if user > 0 then if sub > 0 then - write(format("[%s.%s.%s",real,user,sub)) + logs.report("pages", "flushing page, realpage %s, userpage %s, subpage %s",real,user,sub) else - write(format("[%s.%s",real,user)) + logs.report("pages", "flushing page, realpage %s, userpage %s",real,user) end else - write(format("[%s",real)) + logs.report("pages", "flushing page, realpage %s",real) end else - write("[-") + logs.report("pages", "flushing page") end end -function logs.tex.stop_page_number() - write("]") -end - logs.tex.report_job_stat = statistics.show_job_stat -- xml logging @@ -4621,7 +4647,7 @@ function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' end end -resolvers.settrace(os.getenv("MTX.resolvers.TRACE") or os.getenv("MTX_INPUT_TRACE")) +resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) function resolvers.osenv(key) local ie = instance.environment diff --git a/scripts/context/lua/luatools.rme b/scripts/context/lua/luatools.rme index b320e1184..901e9a9a3 100644 --- a/scripts/context/lua/luatools.rme +++ b/scripts/context/lua/luatools.rme @@ -1,3 +1,3 @@ On MSWindows the luatools.lua script is called -with luatools.cmd. On Unix you can either rename +with luatools.exe. On Unix you can either rename luatools.lua to luatools, or use a symlink. diff --git a/scripts/context/lua/mtx-babel.lua b/scripts/context/lua/mtx-babel.lua index e241e9334..01e2ba4b2 100644 --- a/scripts/context/lua/mtx-babel.lua +++ b/scripts/context/lua/mtx-babel.lua @@ -415,7 +415,7 @@ do end -logs.extendbanner("Babel Conversion Tools 1.2",true) +logs.extendbanner("Babel Input To UTF Conversion 1.20",true) messages.help = [[ --language=string conversion language (e.g. greek) diff --git a/scripts/context/lua/mtx-cache.lua b/scripts/context/lua/mtx-cache.lua index a1fbed825..9f54d9754 100644 --- a/scripts/context/lua/mtx-cache.lua +++ b/scripts/context/lua/mtx-cache.lua @@ -76,7 +76,7 @@ function scripts.cache.list(all) end) end -logs.extendbanner("Cache Tools 0.10") +logs.extendbanner("ConTeXt & MetaTeX Cache Management 0.10") messages.help = [[ --purge remove not used files diff --git a/scripts/context/lua/mtx-chars.lua b/scripts/context/lua/mtx-chars.lua index d4330ca30..0b93587a3 100644 --- a/scripts/context/lua/mtx-chars.lua +++ b/scripts/context/lua/mtx-chars.lua @@ -11,17 +11,17 @@ local format, concat, utfchar, upper = string.format, table.concat, unicode.utf8 scripts = scripts or { } scripts.chars = scripts.chars or { } -local banner = [[ --- filename : char-mth.lua --- comment : companion to char-mth.tex (in ConTeXt) --- author : Hans Hagen, PRAGMA-ADE, Hasselt NL --- license : see context related readme files --- comment : generated from data file downloaded from STIX website - -if not versions then versions = { } end versions['char-mth'] = 1.001 -if not characters then characters = { } end -]] - +--~ local banner = [[ +--~ -- filename : char-mth.lua +--~ -- comment : companion to char-mth.tex (in ConTeXt) +--~ -- author : Hans Hagen, PRAGMA-ADE, Hasselt NL +--~ -- license : see context related readme files +--~ -- comment : generated from data file downloaded from STIX website +--~ +--~ if not versions then versions = { } end versions['char-mth'] = 1.001 +--~ if not characters then characters = { } end +--~ ]] +--~ --~ function scripts.chars.stixtomkiv(inname,outname) --~ if inname == "" then --~ logs.report("aquiring math data","invalid datafilename") @@ -301,7 +301,7 @@ function scripts.chars.makeencoutf() end end -logs.extendbanner("Character Tools 0.10") +logs.extendbanner("MkII Character Table Generators 0.10") messages.help = [[ --stix convert stix table to math table diff --git a/scripts/context/lua/mtx-check.lua b/scripts/context/lua/mtx-check.lua index 6be7f2765..436a205e0 100644 --- a/scripts/context/lua/mtx-check.lua +++ b/scripts/context/lua/mtx-check.lua @@ -123,7 +123,7 @@ function scripts.checker.check(filename) end end -logs.extendbanner("Syntax Checking 0.10",true) +logs.extendbanner("Basic ConTeXt Syntax Checking 0.10",true) messages.help = [[ --convert check tex file for errors diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index b146b3c09..2ed661774 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -1381,7 +1381,7 @@ function scripts.context.update() end end -logs.extendbanner("ConTeXt Tools 0.51",true) +logs.extendbanner("ConTeXt Process Management 0.51",true) messages.help = [[ --run process (one or more) files (default action) diff --git a/scripts/context/lua/mtx-convert.lua b/scripts/context/lua/mtx-convert.lua index 5e9a71573..cb514720e 100644 --- a/scripts/context/lua/mtx-convert.lua +++ b/scripts/context/lua/mtx-convert.lua @@ -118,7 +118,7 @@ function scripts.convert.convertgiven() end -logs.extendbanner("Graphic Conversion Tools 0.10",true) +logs.extendbanner("ConTeXT Graphic Conversion Helpers 0.10",true) messages.help = [[ --convertall convert all graphics on path diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 4d3e52382..bc93eaaa9 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -281,7 +281,7 @@ function scripts.fonts.save() end end -logs.extendbanner("Font Tools 0.21",true) +logs.extendbanner("ConTeXt Font Database Management 0.21",true) messages.help = [[ --save save open type font in raw table diff --git a/scripts/context/lua/mtx-interface.lua b/scripts/context/lua/mtx-interface.lua index 264a2dbe4..4aaa3b5a0 100644 --- a/scripts/context/lua/mtx-interface.lua +++ b/scripts/context/lua/mtx-interface.lua @@ -234,7 +234,7 @@ function scripts.interface.messages() end end -logs.extendbanner("Interface Tools 0.11",true) +logs.extendbanner("ConTeXt Interface Related Goodies 0.11",true) messages.help = [[ --scite generate scite interface diff --git a/scripts/context/lua/mtx-metatex.lua b/scripts/context/lua/mtx-metatex.lua index f8c871a7b..4453e2ccb 100644 --- a/scripts/context/lua/mtx-metatex.lua +++ b/scripts/context/lua/mtx-metatex.lua @@ -49,7 +49,7 @@ function scripts.metatex.timed(action) statistics.timed(action) end -logs.extendbanner("MetaTeX Tools 0.10",true) +logs.extendbanner("MetaTeX Process Management 0.10",true) messages.help = [[ --run process (one or more) files (default action) diff --git a/scripts/context/lua/mtx-modules.lua b/scripts/context/lua/mtx-modules.lua index 1a6593004..9ade1fc23 100644 --- a/scripts/context/lua/mtx-modules.lua +++ b/scripts/context/lua/mtx-modules.lua @@ -147,7 +147,7 @@ end -- context --ctx=m-modules.ctx xxx.mkiv -logs.extendbanner("Module Documentation Tools 1.0",true) +logs.extendbanner("ConTeXt Module Documentation Generators 1.00",true) messages.help = [[ --convert convert source files (tex, mkii, mkiv, mp) to 'ted' files diff --git a/scripts/context/lua/mtx-package.lua b/scripts/context/lua/mtx-package.lua index 06c89907a..b36fc0ed8 100644 --- a/scripts/context/lua/mtx-package.lua +++ b/scripts/context/lua/mtx-package.lua @@ -55,7 +55,7 @@ function scripts.package.merge_luatex_files(name,strip) end end -logs.extendbanner("Package Tools 0.1",true) +logs.extendbanner("Distribution Related Goodies 0.10",true) messages.help = [[ --merge merge 'loadmodule' into merge file diff --git a/scripts/context/lua/mtx-patterns.lua b/scripts/context/lua/mtx-patterns.lua index 7f130465b..758ea55c9 100644 --- a/scripts/context/lua/mtx-patterns.lua +++ b/scripts/context/lua/mtx-patterns.lua @@ -337,7 +337,7 @@ function scripts.patterns.convert() end end -logs.extendbanner("Pattern Tools 0.20",true) +logs.extendbanner("ConTeXt Pattern File Management 0.20",true) messages.help = [[ --convert generate context language files (mnemonic driven, if not given then all) diff --git a/scripts/context/lua/mtx-profile.lua b/scripts/context/lua/mtx-profile.lua index 1db9682ac..9e2aed288 100644 --- a/scripts/context/lua/mtx-profile.lua +++ b/scripts/context/lua/mtx-profile.lua @@ -148,7 +148,7 @@ end --~ scripts.profiler.analyse("t:/manuals/mk/mk-fonts-profile.lua") --~ scripts.profiler.analyse("t:/manuals/mk/mk-introduction-profile.lua") -logs.extendbanner("LuaTeX Profiler 1.00",true) +logs.extendbanner("ConTeXt MkIV LuaTeX Profiler 1.00",true) messages.help = [[ --analyse analyse lua calls diff --git a/scripts/context/lua/mtx-server.lua b/scripts/context/lua/mtx-server.lua index a1a5d51b3..871354394 100644 --- a/scripts/context/lua/mtx-server.lua +++ b/scripts/context/lua/mtx-server.lua @@ -326,7 +326,7 @@ function scripts.webserver.run(configuration) end end -logs.extendbanner("Simple Webserver 0.10") +logs.extendbanner("Simple Webserver For Helpers 0.10") messages.help = [[ --start start server diff --git a/scripts/context/lua/mtx-texworks.lua b/scripts/context/lua/mtx-texworks.lua index 77d257480..401408b32 100644 --- a/scripts/context/lua/mtx-texworks.lua +++ b/scripts/context/lua/mtx-texworks.lua @@ -80,7 +80,7 @@ function scripts.texworks.start(indeed) end -logs.extendbanner("TeXworks startup script 1.0",true) +logs.extendbanner("TeXworks Startup Script 1.00",true) messages.help = [[ --start [--verbose] start texworks diff --git a/scripts/context/lua/mtx-timing.lua b/scripts/context/lua/mtx-timing.lua index 1dcb9aa0e..375d5d90b 100644 --- a/scripts/context/lua/mtx-timing.lua +++ b/scripts/context/lua/mtx-timing.lua @@ -186,7 +186,7 @@ function scripts.timings.xhtml(filename) end end -logs.extendbanner("ConTeXt Timing Tools 0.1",true) +logs.extendbanner("ConTeXt Timing Tools 0.10",true) messages.help = [[ --xhtml make xhtml file diff --git a/scripts/context/lua/mtx-tools.lua b/scripts/context/lua/mtx-tools.lua index 87fd51dc6..ca2faaf29 100644 --- a/scripts/context/lua/mtx-tools.lua +++ b/scripts/context/lua/mtx-tools.lua @@ -44,7 +44,7 @@ function scripts.tools.disarmutfbomb() end end -logs.extendbanner("All Kind Of Tools 1.0",true) +logs.extendbanner("Some File Related Goodies 1.00",true) messages.help = [[ --disarmutfbomb remove utf bomb if present diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua index 3dd2f0e47..61d6b0d84 100644 --- a/scripts/context/lua/mtx-update.lua +++ b/scripts/context/lua/mtx-update.lua @@ -445,7 +445,7 @@ function scripts.update.make() logs.report("make","done") end -logs.extendbanner("Download Tools 0.20",true) +logs.extendbanner("ConTeXt Minimals Updater 0.21",true) messages.help = [[ --platform=string platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc) diff --git a/scripts/context/lua/mtx-watch.lua b/scripts/context/lua/mtx-watch.lua index 2e4dcf6ef..44f61ae6b 100644 --- a/scripts/context/lua/mtx-watch.lua +++ b/scripts/context/lua/mtx-watch.lua @@ -239,7 +239,7 @@ function scripts.watch.show_logs(path) -- removes duplicates end end -logs.extendbanner("Watchdog 1.00",true) +logs.extendbanner("ConTeXt Request Watchdog 1.00",true) messages.help = [[ --logpath optional path for log files diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index a187f0697..ceb9cb886 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1789,6 +1789,7 @@ function os.currentplatform(name,default) platform = "linux" end elseif name == "macosx" then + local architecture = os.resultof("echo $HOSTTYPE") if find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then @@ -4773,8 +4774,9 @@ local lp_and = P("&") / " and " local lp_builtin = P ( P("first") / "1" + P("last") / "#list" + - P("position") / "l" + + P("position") / "l" + -- is element in finalizer P("rootposition") / "order" + + P("order") / "order" + P("index") / "(ll.ni or 1)" + P("match") / "(ll.mi or 1)" + P("text") / "(ll.dt[1] or '')" + @@ -6125,11 +6127,15 @@ local function position(collected,n) elseif n > 0 then return collected[n] else - return collected[1].mi -- match + return collected[1].mi or 0 end end end +local function match(collected) + return (collected and collected[1].mi) or 0 -- match +end + local function index(collected) if collected then return collected[1].ni @@ -6283,6 +6289,7 @@ finalizers.attribute = attribute finalizers.att = att finalizers.count = count finalizers.position = position +finalizers.match = match finalizers.index = index finalizers.attributes = attributes finalizers.chainattribute = chainattribute @@ -6334,10 +6341,14 @@ end xml.content = text -function xml.position(id,pattern,n) +function xml.position(id,pattern,n) -- element return position(xmlfilter(id,pattern),n) end +function xml.match(id,pattern) -- number + return match(xmlfilter(id,pattern)) +end + function xml.empty(id,pattern) return empty(xmlfilter(id,pattern)) end @@ -6801,7 +6812,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-log'] = { +if not modules then modules = { } end modules ['trac-log'] = { version = 1.001, comment = "companion to trac-log.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -7078,8 +7089,12 @@ end logs.simpleline = logs.reportline -function logs.help(message,option) +function logs.reportbanner() -- for scripts too logs.report(banner) +end + +function logs.help(message,option) + logs.reportbanner() logs.reportline() logs.reportlines(message) local moreinfo = logs.moreinfo or "" @@ -7380,7 +7395,7 @@ function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' end end -resolvers.settrace(os.getenv("MTX.resolvers.TRACE") or os.getenv("MTX_INPUT_TRACE")) +resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) function resolvers.osenv(key) local ie = instance.environment @@ -10639,7 +10654,7 @@ runners = runners or { } -- global messages = messages or { } messages.help = [[ ---script run an mtx script (--noquotes) +--script run an mtx script (--noquotes), no script gives list --execute run a script or program (--noquotes) --resolve resolve prefixed arguments --ctxlua run internally (using preloaded libs) @@ -10685,20 +10700,17 @@ runners.suffixes = { } runners.registered = { - texexec = { 'texexec.rb', true }, -- context mkii runner (only tool not to be luafied) + texexec = { 'texexec.rb', false }, -- context mkii runner (only tool not to be luafied) texutil = { 'texutil.rb', true }, -- old perl based index sorter for mkii (old versions need it) texfont = { 'texfont.pl', true }, -- perl script that makes mkii font metric files texfind = { 'texfind.pl', false }, -- perltk based tex searching tool, mostly used at pragma texshow = { 'texshow.pl', false }, -- perltk based context help system, will be luafied - -- texwork = { \texwork.pl', false }, -- perltk based editing environment, only used at pragma - + -- texwork = { 'texwork.pl', false }, -- perltk based editing environment, only used at pragma makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) - -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, - runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, tmftools = { 'tmftools.rb', true }, @@ -10710,7 +10722,6 @@ runners.registered = { xmltools = { 'xmltools.rb', true }, -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, - pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -10763,7 +10774,7 @@ function runners.prepare() return "run" end -function runners.execute_script(fullname,internal) +function runners.execute_script(fullname,internal,nosplit) local noquote = environment.argument("noquotes") if fullname and fullname ~= "" then local state = runners.prepare() @@ -10803,17 +10814,19 @@ function runners.execute_script(fullname,internal) end end if result and result ~= "" then - local before, after = environment.split_arguments(fullname) -- already done - environment.arguments_before, environment.arguments_after = before, after + if not no_split then + local before, after = environment.split_arguments(fullname) -- already done + environment.arguments_before, environment.arguments_after = before, after + end if internal then - arg = { } for _,v in pairs(after) do arg[#arg+1] = v end + arg = { } for _,v in pairs(environment.arguments_after) do arg[#arg+1] = v end dofile(result) else local binary = runners.applications[file.extname(result)] if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(after,noquote) + local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) if logs.verbose then logs.simpleline() logs.simple("executing: %s",command) @@ -10821,7 +10834,7 @@ function runners.execute_script(fullname,internal) logs.simpleline() io.flush() end - local code = os.exec(command) -- maybe spawn + local code = os.exec(command) -- maybe spawn return code == 0 end end @@ -10855,7 +10868,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse +-- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -11096,22 +11109,35 @@ function runners.execute_ctx_script(filename,arguments) return true end else - logs.setverbose(true) - if filename == "" then - logs.simple("unknown script, no name given") + -- logs.setverbose(true) + if filename == "" or filename == "help" then local context = resolvers.find_file("mtx-context.lua") + logs.setverbose(true) if context ~= "" then local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } + table.sort(result) for _, scriptname in ipairs(result) do - scriptname = string.match(scriptname,".*mtx%-([^%-]-)%.lua") - if scriptname then - valid[#valid+1] = scriptname + local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + if scriptbase then + local data = io.loaddata(scriptname) + local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + if banner then + valid[#valid+1] = { scriptbase, version, banner } + end end end if #valid > 0 then - logs.simple("known scripts: %s",table.concat(valid,", ")) + logs.reportbanner() + logs.reportline() + logs.simple("no script name given, known scripts:") + logs.simple() + for k, v in ipairs(valid) do + logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + end end + else + logs.simple("no script name given") end else filename = file.addsuffix(filename,"lua") @@ -11125,6 +11151,7 @@ function runners.execute_ctx_script(filename,arguments) end end + function runners.timedrun(filename) -- just for me if filename and filename ~= "" then runners.timed(function() os.execute(filename) end) @@ -11152,7 +11179,9 @@ instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level -if environment.argument("usekpse") or environment.argument("forcekpse") then +local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename))] + +if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then os.setenv("engine","") os.setenv("progname","") @@ -11187,7 +11216,7 @@ if environment.argument("usekpse") or environment.argument("forcekpse") then return (kpse_initialized():show_path(name)) or "" end - elseif environment.argument("usekpse") then + elseif environment.argument("usekpse") or is_mkii_stub then resolvers.load() @@ -11222,7 +11251,10 @@ if trackspec then trackers.enable(trackspec) end -if environment.argument("selfmerge") then +if is_mkii_stub then + -- execute mkii script + ok = runners.execute_script(filename,false,true) +elseif environment.argument("selfmerge") then -- embed used libraries utils.merger.selfmerge(own.name,own.libs,own.list) elseif environment.argument("selfclean") then diff --git a/scripts/context/lua/mtxrun.rme b/scripts/context/lua/mtxrun.rme index 9cb56486a..9850e389d 100644 --- a/scripts/context/lua/mtxrun.rme +++ b/scripts/context/lua/mtxrun.rme @@ -1,3 +1,18 @@ -On MSWindows the mtxrun.lua script is called -with mtxrun.cmd. On Unix you can either rename -mtxrun.lua to mtxrun, or use a symlink. +On MSWindows the mtxrun.lua script is called with +mtxrun.exe. On Unix you can either rename mtxrun.lua +to mtxrun, or use a symlink. + +You can create additional stubs, like + +copy mtxrun.exe luatools.exe +copy mtxrun.exe texexec.exe +copy mtxrun.exe context.exe +copy mtxrun.exe mtx-server.exe + +The mtxrun.exe program is rather dump and only +intercepts mtxrun, luatools and texmfstart (for +old times sake) and passes the buck to mtxrun.lua +which happens to know enough of mkii to deal +with kpse based lookups and therefore acts like +texmfstart but when used with mkiv it behaves +more clever and looks for more. diff --git a/scripts/context/ruby/newimgtopdf.rb b/scripts/context/ruby/newimgtopdf.rb deleted file mode 100644 index 563ae5b80..000000000 --- a/scripts/context/ruby/newimgtopdf.rb +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby - -# program : imgtopdf -# copyright : PRAGMA Advanced Document Engineering -# version : 2002-2005 -# author : Hans Hagen - -load(File.join(File.expand_path(File.dirname($0)),'imgtopdf.rb')) diff --git a/scripts/context/ruby/newpstopdf.rb b/scripts/context/ruby/newpstopdf.rb deleted file mode 100644 index a45b4cab8..000000000 --- a/scripts/context/ruby/newpstopdf.rb +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby - -# program : pstopdf -# copyright : PRAGMA Advanced Document Engineering -# version : 2002-2005 -# author : Hans Hagen - -load(File.join(File.expand_path(File.dirname($0)),'pstopdf.rb')) diff --git a/scripts/context/ruby/newtexexec.rb b/scripts/context/ruby/newtexexec.rb deleted file mode 100644 index 6b4db52dc..000000000 --- a/scripts/context/ruby/newtexexec.rb +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby - -# program : texexec -# copyright : PRAGMA Advanced Document Engineering -# version : 1997-2006 -# author : Hans Hagen - -load(File.join(File.expand_path(File.dirname($0)),'texexec.rb')) diff --git a/scripts/context/ruby/newtexutil.rb b/scripts/context/ruby/newtexutil.rb deleted file mode 100644 index d6dd06a71..000000000 --- a/scripts/context/ruby/newtexutil.rb +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby - -# program : texexec -# copyright : PRAGMA Advanced Document Engineering -# version : 1997-2006 -# author : Hans Hagen - -load(File.join(File.expand_path(File.dirname($0)),'texutil.rb')) diff --git a/scripts/context/stubs/mswin/context.cmd b/scripts/context/stubs/mswin/context.cmd deleted file mode 100644 index 64ac1ea91..000000000 --- a/scripts/context/stubs/mswin/context.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --script context %* -endlocal diff --git a/scripts/context/stubs/mswin/context.exe b/scripts/context/stubs/mswin/context.exe Binary files differnew file mode 100755 index 000000000..968f672b6 --- /dev/null +++ b/scripts/context/stubs/mswin/context.exe diff --git a/scripts/context/stubs/mswin/ctxtools.bat b/scripts/context/stubs/mswin/ctxtools.bat deleted file mode 100755 index 8047c9b68..000000000 --- a/scripts/context/stubs/mswin/ctxtools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute ctxtools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/luatools.cmd b/scripts/context/stubs/mswin/luatools.cmd deleted file mode 100644 index 4bc998d65..000000000 --- a/scripts/context/stubs/mswin/luatools.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%luatools.lua" %* -endlocal diff --git a/scripts/context/stubs/mswin/luatools.exe b/scripts/context/stubs/mswin/luatools.exe Binary files differnew file mode 100755 index 000000000..968f672b6 --- /dev/null +++ b/scripts/context/stubs/mswin/luatools.exe diff --git a/scripts/context/stubs/mswin/luatools.lua b/scripts/context/stubs/mswin/luatools.lua index 692213b09..6feb7a9c5 100644 --- a/scripts/context/stubs/mswin/luatools.lua +++ b/scripts/context/stubs/mswin/luatools.lua @@ -1780,6 +1780,7 @@ function os.currentplatform(name,default) platform = "linux" end elseif name == "macosx" then + local architecture = os.resultof("echo $HOSTTYPE") if find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then @@ -1881,8 +1882,8 @@ function file.nameonly(name) return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.extname(name) - return match(name,"^.+%.([^/\\]-)$") or "" +function file.extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end file.suffix = file.extname @@ -3757,7 +3758,7 @@ end if arg then - -- new, reconstruct quoted snippets (maybe better just remnove the " then and add them later) + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) local newarg, instring = { }, false for index, argument in ipairs(arg) do @@ -4077,6 +4078,9 @@ if not modules then modules = { } end modules ['luat-log'] = { -- this is old code that needs an overhaul +--~ io.stdout:setvbuf("no") +--~ io.stderr:setvbuf("no") + local write_nl, write, format = texio.write_nl or print, texio.write or io.write, string.format local texcount = tex and tex.count @@ -4158,27 +4162,49 @@ function logs.tex.line(fmt,...) -- new end end +--~ function logs.tex.start_page_number() +--~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +--~ if real > 0 then +--~ if user > 0 then +--~ if sub > 0 then +--~ write(format("[%s.%s.%s",real,user,sub)) +--~ else +--~ write(format("[%s.%s",real,user)) +--~ end +--~ else +--~ write(format("[%s",real)) +--~ end +--~ else +--~ write("[-") +--~ end +--~ end + +--~ function logs.tex.stop_page_number() +--~ write("]") +--~ end + +local real, user, sub + function logs.tex.start_page_number() - local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.tex.stop_page_number() if real > 0 then if user > 0 then if sub > 0 then - write(format("[%s.%s.%s",real,user,sub)) + logs.report("pages", "flushing page, realpage %s, userpage %s, subpage %s",real,user,sub) else - write(format("[%s.%s",real,user)) + logs.report("pages", "flushing page, realpage %s, userpage %s",real,user) end else - write(format("[%s",real)) + logs.report("pages", "flushing page, realpage %s",real) end else - write("[-") + logs.report("pages", "flushing page") end end -function logs.tex.stop_page_number() - write("]") -end - logs.tex.report_job_stat = statistics.show_job_stat -- xml logging @@ -4621,7 +4647,7 @@ function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' end end -resolvers.settrace(os.getenv("MTX.resolvers.TRACE") or os.getenv("MTX_INPUT_TRACE")) +resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) function resolvers.osenv(key) local ie = instance.environment diff --git a/scripts/context/stubs/mswin/makempy.bat b/scripts/context/stubs/mswin/makempy.bat deleted file mode 100755 index 03eaa8a28..000000000 --- a/scripts/context/stubs/mswin/makempy.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute makempy.pl %* -endlocal diff --git a/scripts/context/stubs/mswin/metatex.cmd b/scripts/context/stubs/mswin/metatex.cmd deleted file mode 100644 index 858f28f8f..000000000 --- a/scripts/context/stubs/mswin/metatex.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --script metatex %* -endlocal diff --git a/scripts/context/stubs/mswin/metatex.exe b/scripts/context/stubs/mswin/metatex.exe Binary files differnew file mode 100755 index 000000000..968f672b6 --- /dev/null +++ b/scripts/context/stubs/mswin/metatex.exe diff --git a/scripts/context/stubs/mswin/mpstools.bat b/scripts/context/stubs/mswin/mpstools.bat deleted file mode 100755 index 8bd25674c..000000000 --- a/scripts/context/stubs/mswin/mpstools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute mpstools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/mptopdf.bat b/scripts/context/stubs/mswin/mptopdf.bat deleted file mode 100755 index f29881763..000000000 --- a/scripts/context/stubs/mswin/mptopdf.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute mptopdf.pl %* -endlocal diff --git a/scripts/context/stubs/mswin/mtxrun.cmd b/scripts/context/stubs/mswin/mtxrun.cmd deleted file mode 100644 index f30148ddb..000000000 --- a/scripts/context/stubs/mswin/mtxrun.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" %* -endlocal diff --git a/scripts/context/stubs/mswin/mtxrun.dll b/scripts/context/stubs/mswin/mtxrun.dll Binary files differnew file mode 100644 index 000000000..f8e720f55 --- /dev/null +++ b/scripts/context/stubs/mswin/mtxrun.dll diff --git a/scripts/context/stubs/mswin/mtxrun.exe b/scripts/context/stubs/mswin/mtxrun.exe Binary files differnew file mode 100755 index 000000000..968f672b6 --- /dev/null +++ b/scripts/context/stubs/mswin/mtxrun.exe diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index a187f0697..ceb9cb886 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -1789,6 +1789,7 @@ function os.currentplatform(name,default) platform = "linux" end elseif name == "macosx" then + local architecture = os.resultof("echo $HOSTTYPE") if find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then @@ -4773,8 +4774,9 @@ local lp_and = P("&") / " and " local lp_builtin = P ( P("first") / "1" + P("last") / "#list" + - P("position") / "l" + + P("position") / "l" + -- is element in finalizer P("rootposition") / "order" + + P("order") / "order" + P("index") / "(ll.ni or 1)" + P("match") / "(ll.mi or 1)" + P("text") / "(ll.dt[1] or '')" + @@ -6125,11 +6127,15 @@ local function position(collected,n) elseif n > 0 then return collected[n] else - return collected[1].mi -- match + return collected[1].mi or 0 end end end +local function match(collected) + return (collected and collected[1].mi) or 0 -- match +end + local function index(collected) if collected then return collected[1].ni @@ -6283,6 +6289,7 @@ finalizers.attribute = attribute finalizers.att = att finalizers.count = count finalizers.position = position +finalizers.match = match finalizers.index = index finalizers.attributes = attributes finalizers.chainattribute = chainattribute @@ -6334,10 +6341,14 @@ end xml.content = text -function xml.position(id,pattern,n) +function xml.position(id,pattern,n) -- element return position(xmlfilter(id,pattern),n) end +function xml.match(id,pattern) -- number + return match(xmlfilter(id,pattern)) +end + function xml.empty(id,pattern) return empty(xmlfilter(id,pattern)) end @@ -6801,7 +6812,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-log'] = { +if not modules then modules = { } end modules ['trac-log'] = { version = 1.001, comment = "companion to trac-log.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -7078,8 +7089,12 @@ end logs.simpleline = logs.reportline -function logs.help(message,option) +function logs.reportbanner() -- for scripts too logs.report(banner) +end + +function logs.help(message,option) + logs.reportbanner() logs.reportline() logs.reportlines(message) local moreinfo = logs.moreinfo or "" @@ -7380,7 +7395,7 @@ function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' end end -resolvers.settrace(os.getenv("MTX.resolvers.TRACE") or os.getenv("MTX_INPUT_TRACE")) +resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) function resolvers.osenv(key) local ie = instance.environment @@ -10639,7 +10654,7 @@ runners = runners or { } -- global messages = messages or { } messages.help = [[ ---script run an mtx script (--noquotes) +--script run an mtx script (--noquotes), no script gives list --execute run a script or program (--noquotes) --resolve resolve prefixed arguments --ctxlua run internally (using preloaded libs) @@ -10685,20 +10700,17 @@ runners.suffixes = { } runners.registered = { - texexec = { 'texexec.rb', true }, -- context mkii runner (only tool not to be luafied) + texexec = { 'texexec.rb', false }, -- context mkii runner (only tool not to be luafied) texutil = { 'texutil.rb', true }, -- old perl based index sorter for mkii (old versions need it) texfont = { 'texfont.pl', true }, -- perl script that makes mkii font metric files texfind = { 'texfind.pl', false }, -- perltk based tex searching tool, mostly used at pragma texshow = { 'texshow.pl', false }, -- perltk based context help system, will be luafied - -- texwork = { \texwork.pl', false }, -- perltk based editing environment, only used at pragma - + -- texwork = { 'texwork.pl', false }, -- perltk based editing environment, only used at pragma makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) - -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, - runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, tmftools = { 'tmftools.rb', true }, @@ -10710,7 +10722,6 @@ runners.registered = { xmltools = { 'xmltools.rb', true }, -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, - pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -10763,7 +10774,7 @@ function runners.prepare() return "run" end -function runners.execute_script(fullname,internal) +function runners.execute_script(fullname,internal,nosplit) local noquote = environment.argument("noquotes") if fullname and fullname ~= "" then local state = runners.prepare() @@ -10803,17 +10814,19 @@ function runners.execute_script(fullname,internal) end end if result and result ~= "" then - local before, after = environment.split_arguments(fullname) -- already done - environment.arguments_before, environment.arguments_after = before, after + if not no_split then + local before, after = environment.split_arguments(fullname) -- already done + environment.arguments_before, environment.arguments_after = before, after + end if internal then - arg = { } for _,v in pairs(after) do arg[#arg+1] = v end + arg = { } for _,v in pairs(environment.arguments_after) do arg[#arg+1] = v end dofile(result) else local binary = runners.applications[file.extname(result)] if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(after,noquote) + local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) if logs.verbose then logs.simpleline() logs.simple("executing: %s",command) @@ -10821,7 +10834,7 @@ function runners.execute_script(fullname,internal) logs.simpleline() io.flush() end - local code = os.exec(command) -- maybe spawn + local code = os.exec(command) -- maybe spawn return code == 0 end end @@ -10855,7 +10868,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse +-- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -11096,22 +11109,35 @@ function runners.execute_ctx_script(filename,arguments) return true end else - logs.setverbose(true) - if filename == "" then - logs.simple("unknown script, no name given") + -- logs.setverbose(true) + if filename == "" or filename == "help" then local context = resolvers.find_file("mtx-context.lua") + logs.setverbose(true) if context ~= "" then local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } + table.sort(result) for _, scriptname in ipairs(result) do - scriptname = string.match(scriptname,".*mtx%-([^%-]-)%.lua") - if scriptname then - valid[#valid+1] = scriptname + local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + if scriptbase then + local data = io.loaddata(scriptname) + local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + if banner then + valid[#valid+1] = { scriptbase, version, banner } + end end end if #valid > 0 then - logs.simple("known scripts: %s",table.concat(valid,", ")) + logs.reportbanner() + logs.reportline() + logs.simple("no script name given, known scripts:") + logs.simple() + for k, v in ipairs(valid) do + logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + end end + else + logs.simple("no script name given") end else filename = file.addsuffix(filename,"lua") @@ -11125,6 +11151,7 @@ function runners.execute_ctx_script(filename,arguments) end end + function runners.timedrun(filename) -- just for me if filename and filename ~= "" then runners.timed(function() os.execute(filename) end) @@ -11152,7 +11179,9 @@ instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level -if environment.argument("usekpse") or environment.argument("forcekpse") then +local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename))] + +if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then os.setenv("engine","") os.setenv("progname","") @@ -11187,7 +11216,7 @@ if environment.argument("usekpse") or environment.argument("forcekpse") then return (kpse_initialized():show_path(name)) or "" end - elseif environment.argument("usekpse") then + elseif environment.argument("usekpse") or is_mkii_stub then resolvers.load() @@ -11222,7 +11251,10 @@ if trackspec then trackers.enable(trackspec) end -if environment.argument("selfmerge") then +if is_mkii_stub then + -- execute mkii script + ok = runners.execute_script(filename,false,true) +elseif environment.argument("selfmerge") then -- embed used libraries utils.merger.selfmerge(own.name,own.libs,own.list) elseif environment.argument("selfclean") then diff --git a/scripts/context/stubs/mswin/mtxtools.bat b/scripts/context/stubs/mswin/mtxtools.bat deleted file mode 100755 index 9554220c4..000000000 --- a/scripts/context/stubs/mswin/mtxtools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute mtxtools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/mtxworks.cmd b/scripts/context/stubs/mswin/mtxworks.cmd deleted file mode 100644 index 322d9464d..000000000 --- a/scripts/context/stubs/mswin/mtxworks.cmd +++ /dev/null @@ -1 +0,0 @@ -mtxrun --script texworks --start diff --git a/scripts/context/stubs/mswin/mtxworks.exe b/scripts/context/stubs/mswin/mtxworks.exe Binary files differnew file mode 100755 index 000000000..968f672b6 --- /dev/null +++ b/scripts/context/stubs/mswin/mtxworks.exe diff --git a/scripts/context/stubs/mswin/pdftools.bat b/scripts/context/stubs/mswin/pdftools.bat deleted file mode 100755 index 5e893fb2a..000000000 --- a/scripts/context/stubs/mswin/pdftools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute pdftools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/pstopdf.bat b/scripts/context/stubs/mswin/pstopdf.bat deleted file mode 100755 index f8d4325f4..000000000 --- a/scripts/context/stubs/mswin/pstopdf.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute pstopdf.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/rlxtools.bat b/scripts/context/stubs/mswin/rlxtools.bat deleted file mode 100755 index 82f09665a..000000000 --- a/scripts/context/stubs/mswin/rlxtools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute rlxtools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/runtools.bat b/scripts/context/stubs/mswin/runtools.bat deleted file mode 100755 index f471e747d..000000000 --- a/scripts/context/stubs/mswin/runtools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute runtools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/texexec.bat b/scripts/context/stubs/mswin/texexec.bat deleted file mode 100755 index acbe41fd8..000000000 --- a/scripts/context/stubs/mswin/texexec.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute texexec.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/texexec.cmd b/scripts/context/stubs/mswin/texexec.cmd deleted file mode 100644 index acbe41fd8..000000000 --- a/scripts/context/stubs/mswin/texexec.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute texexec.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/texexec.exe b/scripts/context/stubs/mswin/texexec.exe Binary files differnew file mode 100755 index 000000000..968f672b6 --- /dev/null +++ b/scripts/context/stubs/mswin/texexec.exe diff --git a/scripts/context/stubs/mswin/texfont.bat b/scripts/context/stubs/mswin/texfont.bat deleted file mode 100755 index 98e9f7c76..000000000 --- a/scripts/context/stubs/mswin/texfont.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute texfont.pl %* -endlocal diff --git a/scripts/context/stubs/mswin/texmfstart.cmd b/scripts/context/stubs/mswin/texmfstart.cmd deleted file mode 100644 index 47a10cc54..000000000 --- a/scripts/context/stubs/mswin/texmfstart.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse %* -endlocal diff --git a/scripts/context/stubs/mswin/texmfstart.exe b/scripts/context/stubs/mswin/texmfstart.exe Binary files differnew file mode 100755 index 000000000..968f672b6 --- /dev/null +++ b/scripts/context/stubs/mswin/texmfstart.exe diff --git a/scripts/context/stubs/mswin/textools.bat b/scripts/context/stubs/mswin/textools.bat deleted file mode 100755 index 3b047ba7d..000000000 --- a/scripts/context/stubs/mswin/textools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute textools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/texutil.bat b/scripts/context/stubs/mswin/texutil.bat deleted file mode 100755 index f01ced1a3..000000000 --- a/scripts/context/stubs/mswin/texutil.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute texutil.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/tmftools.bat b/scripts/context/stubs/mswin/tmftools.bat deleted file mode 100755 index 689a93c65..000000000 --- a/scripts/context/stubs/mswin/tmftools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute tmftools.rb %* -endlocal diff --git a/scripts/context/stubs/mswin/xmltools.bat b/scripts/context/stubs/mswin/xmltools.bat deleted file mode 100755 index 572cc9b8b..000000000 --- a/scripts/context/stubs/mswin/xmltools.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set ownpath=%~dp0% -texlua "%ownpath%mtxrun.lua" --usekpse --execute xmltools.rb %* -endlocal diff --git a/scripts/context/stubs/source/mtxrun_dll.c b/scripts/context/stubs/source/mtxrun_dll.c new file mode 100644 index 000000000..6cac18c9b --- /dev/null +++ b/scripts/context/stubs/source/mtxrun_dll.c @@ -0,0 +1,214 @@ +/* + +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. + +Comment: + +In ConTeXt MkIV we have two core scripts: luatools.lua and +mtxrun.lua where the second one is used to launch other scripts. +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. + +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 + +*/ + +#include <windows.h> +#include <stdio.h> + +#define IS_WHITESPACE(c) ((c == ' ') || (c == '\t')) +#define MAX_CMD 32768 +//~ #define DRYRUN + +static char dirname [MAX_PATH]; +static char basename[MAX_PATH]; +static char progname[MAX_PATH]; +static char cmdline [MAX_CMD]; + +__declspec(dllexport) int dllrunscript( int argc, char *argv[] ) { + + int i; + + static char path[MAX_PATH]; + + // get file name of this executable and split it into parts + + DWORD nchars = GetModuleFileNameA(NULL, path, MAX_PATH); + if ( !nchars || (nchars == MAX_PATH) ) { + fprintf(stderr, "mtxrun: unable to determine a valid own name\n"); + return -1; + } + + // file extension part + + i = strlen(path); + + while ( i && (path[i] != '.') && (path[i] != '\\') ) i--; + + strcpy(basename, path); + + if ( basename[i] == '.' ) basename[i] = '\0'; //remove file extension + + // file name part + + while ( i && (path[i] != '\\') ) i--; + + if ( path[i] != '\\' ) { + fprintf(stderr, "mtxrun: the runner has no directory part in its name: %s\n", path); + return -1; + } + + strcpy(dirname, path); + dirname[i+1] = '\0'; //remove file name, leave trailing backslash + strcpy(progname, &basename[i+1]); + + // find program to execute + + if ( (strlen(basename)+100 >= MAX_PATH) ) { + fprintf(stderr, "mtxrun: the runners path is too long: %s\n", path); + return -1; + } + + // check .lua + + strcpy(path, dirname); + strcat(path, "mtxrun.lua"); + + if ( GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES ) { + goto PROGRAM_FOUND; + } else { + fprintf(stderr, "mtxrun: the mtxrun.lua file is not in the same path\n"); + return -1; + } + +PROGRAM_FOUND: + + strcpy(cmdline,"texlua.exe "); + + if ( ( strcmp(progname,"mtxrun") == 0 ) || ( strcmp(progname,"luatools") == 0 ) ) { + strcat(cmdline, dirname); + strcat(cmdline,progname); + strcat(cmdline, ".lua"); + } else if ( ( strcmp(progname,"texmfstart") == 0 ) ) { + strcat(cmdline, dirname); + strcat(cmdline,"mtxrun.lua"); + } else { + strcat(cmdline, dirname); + strcat(cmdline, "mtxrun.lua --script "); + strcat(cmdline,progname); + } + + // get the command line for this process + + char *argstr; + argstr = GetCommandLineA(); + if ( argstr == NULL ) { + fprintf(stderr, "mtxrun: fetching the command line string fails\n"); + return -1; + } + + // skip over argv[0] (it can contain embedded double quotes if launched from cmd.exe!) + + int argstrlen = strlen(argstr); + int quoted = 0; + for ( i = 0; ( i < argstrlen) && ( !IS_WHITESPACE(argstr[i]) || quoted ); i++ ) + + if (argstr[i] == '"') quoted = !quoted; + + // while ( IS_WHITESPACE(argstr[i]) ) i++; // arguments leading whitespace + + argstr = &argstr[i]; + + if ( strlen(cmdline) + strlen(argstr) >= MAX_CMD ) { + fprintf(stderr, "mtxrun: the command line string is too long:\n%s%s\n", cmdline, argstr); + return -1; + } + + // pass through all the arguments + + strcat(cmdline, argstr); + +#ifdef DRYRUN + printf("progname : %s\n", progname); + printf("dirname : %s\n", dirname); + printf("arguments : %s\n", &argstr[-i]); + for (i = 0; i < argc; i++) { + printf("argv[%d] : %s\n", i, argv[i]); + } + printf("commandline : %s\n", cmdline); + return; +#endif + + // create child process + + STARTUPINFOA si; // ANSI variant + PROCESS_INFORMATION pi; + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES;// | STARTF_USESHOWWINDOW; + + //si.dwFlags = STARTF_USESHOWWINDOW; + //si.wShowWindow = SW_HIDE ; // can be used to hide console window (requires STARTF_USESHOWWINDOW flag) + + si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + si.hStdError = GetStdHandle(STD_ERROR_HANDLE); + + ZeroMemory( &pi, sizeof(pi) ); + if( !CreateProcessA( + NULL, // module name (uses command line if NULL) + cmdline, // command line + NULL, // process security attributes + NULL, // thread security attributes + TRUE, // handle inheritance + 0, // creation flags, e.g. CREATE_NEW_CONSOLE, CREATE_NO_WINDOW, DETACHED_PROCESS + NULL, // pointer to environment block (uses parent if NULL) + NULL, // starting directory (uses parent if NULL) + &si, // STARTUPINFO structure + &pi ) // PROCESS_INFORMATION structure + ) { + fprintf(stderr, "mtxrun: unable to create a process for: %s\n", cmdline); + return -1; + } + CloseHandle( pi.hThread ); // thread handle is not needed + DWORD ret = 0; + if ( WaitForSingleObject( pi.hProcess, INFINITE ) == WAIT_OBJECT_0 ) { + if ( !GetExitCodeProcess( pi.hProcess, &ret) ) { + fprintf(stderr, "mtxrun: unable to fetch the exit code for process: %s\n", cmdline); + return -1; + } + } else { + fprintf(stderr, "mtxrun: the script has been terminated unexpectedly: %s\n", cmdline); + return -1; + } + CloseHandle( pi.hProcess ); + + return ret; + +} diff --git a/scripts/context/stubs/source/mtxrun_exe.c b/scripts/context/stubs/source/mtxrun_exe.c new file mode 100644 index 000000000..ad014455b --- /dev/null +++ b/scripts/context/stubs/source/mtxrun_exe.c @@ -0,0 +1,10 @@ +// This is the .exe part of the mtxrun program, see mtxrun_dll.c +// for more details. + +#include <windows.h> + +__declspec(dllimport) int dllrunscript( argc, argv ); + +int main( int argc, char *argv[] ) { + return dllrunscript( argc, argv ); +} diff --git a/scripts/context/stubs/source/readme.txt b/scripts/context/stubs/source/readme.txt new file mode 100644 index 000000000..354d85b09 --- /dev/null +++ b/scripts/context/stubs/source/readme.txt @@ -0,0 +1,36 @@ +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. + +Comment: + +In ConTeXt MkIV we have two core scripts: luatools.lua and +mtxrun.lua where the second one is used to launch other scripts. +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. + +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/ctxtools b/scripts/context/stubs/unix/ctxtools deleted file mode 100755 index 4658a345a..000000000 --- a/scripts/context/stubs/unix/ctxtools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute ctxtools.rb "$@" diff --git a/scripts/context/stubs/unix/luatools b/scripts/context/stubs/unix/luatools index 692213b09..6feb7a9c5 100755 --- a/scripts/context/stubs/unix/luatools +++ b/scripts/context/stubs/unix/luatools @@ -1780,6 +1780,7 @@ function os.currentplatform(name,default) platform = "linux" end elseif name == "macosx" then + local architecture = os.resultof("echo $HOSTTYPE") if find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then @@ -1881,8 +1882,8 @@ function file.nameonly(name) return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.extname(name) - return match(name,"^.+%.([^/\\]-)$") or "" +function file.extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end file.suffix = file.extname @@ -3757,7 +3758,7 @@ end if arg then - -- new, reconstruct quoted snippets (maybe better just remnove the " then and add them later) + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) local newarg, instring = { }, false for index, argument in ipairs(arg) do @@ -4077,6 +4078,9 @@ if not modules then modules = { } end modules ['luat-log'] = { -- this is old code that needs an overhaul +--~ io.stdout:setvbuf("no") +--~ io.stderr:setvbuf("no") + local write_nl, write, format = texio.write_nl or print, texio.write or io.write, string.format local texcount = tex and tex.count @@ -4158,27 +4162,49 @@ function logs.tex.line(fmt,...) -- new end end +--~ function logs.tex.start_page_number() +--~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +--~ if real > 0 then +--~ if user > 0 then +--~ if sub > 0 then +--~ write(format("[%s.%s.%s",real,user,sub)) +--~ else +--~ write(format("[%s.%s",real,user)) +--~ end +--~ else +--~ write(format("[%s",real)) +--~ end +--~ else +--~ write("[-") +--~ end +--~ end + +--~ function logs.tex.stop_page_number() +--~ write("]") +--~ end + +local real, user, sub + function logs.tex.start_page_number() - local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.tex.stop_page_number() if real > 0 then if user > 0 then if sub > 0 then - write(format("[%s.%s.%s",real,user,sub)) + logs.report("pages", "flushing page, realpage %s, userpage %s, subpage %s",real,user,sub) else - write(format("[%s.%s",real,user)) + logs.report("pages", "flushing page, realpage %s, userpage %s",real,user) end else - write(format("[%s",real)) + logs.report("pages", "flushing page, realpage %s",real) end else - write("[-") + logs.report("pages", "flushing page") end end -function logs.tex.stop_page_number() - write("]") -end - logs.tex.report_job_stat = statistics.show_job_stat -- xml logging @@ -4621,7 +4647,7 @@ function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' end end -resolvers.settrace(os.getenv("MTX.resolvers.TRACE") or os.getenv("MTX_INPUT_TRACE")) +resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) function resolvers.osenv(key) local ie = instance.environment diff --git a/scripts/context/stubs/unix/makempy b/scripts/context/stubs/unix/makempy deleted file mode 100755 index 34892b284..000000000 --- a/scripts/context/stubs/unix/makempy +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute makempy.pl "$@" diff --git a/scripts/context/stubs/unix/mpstools b/scripts/context/stubs/unix/mpstools deleted file mode 100755 index 1a64d90b0..000000000 --- a/scripts/context/stubs/unix/mpstools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute mpstools.rb "$@" diff --git a/scripts/context/stubs/unix/mptopdf b/scripts/context/stubs/unix/mptopdf deleted file mode 100755 index f57a8b7a7..000000000 --- a/scripts/context/stubs/unix/mptopdf +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute mptopdf.pl "$@" diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index a187f0697..ceb9cb886 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -1789,6 +1789,7 @@ function os.currentplatform(name,default) platform = "linux" end elseif name == "macosx" then + local architecture = os.resultof("echo $HOSTTYPE") if find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then @@ -4773,8 +4774,9 @@ local lp_and = P("&") / " and " local lp_builtin = P ( P("first") / "1" + P("last") / "#list" + - P("position") / "l" + + P("position") / "l" + -- is element in finalizer P("rootposition") / "order" + + P("order") / "order" + P("index") / "(ll.ni or 1)" + P("match") / "(ll.mi or 1)" + P("text") / "(ll.dt[1] or '')" + @@ -6125,11 +6127,15 @@ local function position(collected,n) elseif n > 0 then return collected[n] else - return collected[1].mi -- match + return collected[1].mi or 0 end end end +local function match(collected) + return (collected and collected[1].mi) or 0 -- match +end + local function index(collected) if collected then return collected[1].ni @@ -6283,6 +6289,7 @@ finalizers.attribute = attribute finalizers.att = att finalizers.count = count finalizers.position = position +finalizers.match = match finalizers.index = index finalizers.attributes = attributes finalizers.chainattribute = chainattribute @@ -6334,10 +6341,14 @@ end xml.content = text -function xml.position(id,pattern,n) +function xml.position(id,pattern,n) -- element return position(xmlfilter(id,pattern),n) end +function xml.match(id,pattern) -- number + return match(xmlfilter(id,pattern)) +end + function xml.empty(id,pattern) return empty(xmlfilter(id,pattern)) end @@ -6801,7 +6812,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-log'] = { +if not modules then modules = { } end modules ['trac-log'] = { version = 1.001, comment = "companion to trac-log.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -7078,8 +7089,12 @@ end logs.simpleline = logs.reportline -function logs.help(message,option) +function logs.reportbanner() -- for scripts too logs.report(banner) +end + +function logs.help(message,option) + logs.reportbanner() logs.reportline() logs.reportlines(message) local moreinfo = logs.moreinfo or "" @@ -7380,7 +7395,7 @@ function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' end end -resolvers.settrace(os.getenv("MTX.resolvers.TRACE") or os.getenv("MTX_INPUT_TRACE")) +resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) function resolvers.osenv(key) local ie = instance.environment @@ -10639,7 +10654,7 @@ runners = runners or { } -- global messages = messages or { } messages.help = [[ ---script run an mtx script (--noquotes) +--script run an mtx script (--noquotes), no script gives list --execute run a script or program (--noquotes) --resolve resolve prefixed arguments --ctxlua run internally (using preloaded libs) @@ -10685,20 +10700,17 @@ runners.suffixes = { } runners.registered = { - texexec = { 'texexec.rb', true }, -- context mkii runner (only tool not to be luafied) + texexec = { 'texexec.rb', false }, -- context mkii runner (only tool not to be luafied) texutil = { 'texutil.rb', true }, -- old perl based index sorter for mkii (old versions need it) texfont = { 'texfont.pl', true }, -- perl script that makes mkii font metric files texfind = { 'texfind.pl', false }, -- perltk based tex searching tool, mostly used at pragma texshow = { 'texshow.pl', false }, -- perltk based context help system, will be luafied - -- texwork = { \texwork.pl', false }, -- perltk based editing environment, only used at pragma - + -- texwork = { 'texwork.pl', false }, -- perltk based editing environment, only used at pragma makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) - -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, - runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, tmftools = { 'tmftools.rb', true }, @@ -10710,7 +10722,6 @@ runners.registered = { xmltools = { 'xmltools.rb', true }, -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, - pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -10763,7 +10774,7 @@ function runners.prepare() return "run" end -function runners.execute_script(fullname,internal) +function runners.execute_script(fullname,internal,nosplit) local noquote = environment.argument("noquotes") if fullname and fullname ~= "" then local state = runners.prepare() @@ -10803,17 +10814,19 @@ function runners.execute_script(fullname,internal) end end if result and result ~= "" then - local before, after = environment.split_arguments(fullname) -- already done - environment.arguments_before, environment.arguments_after = before, after + if not no_split then + local before, after = environment.split_arguments(fullname) -- already done + environment.arguments_before, environment.arguments_after = before, after + end if internal then - arg = { } for _,v in pairs(after) do arg[#arg+1] = v end + arg = { } for _,v in pairs(environment.arguments_after) do arg[#arg+1] = v end dofile(result) else local binary = runners.applications[file.extname(result)] if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(after,noquote) + local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) if logs.verbose then logs.simpleline() logs.simple("executing: %s",command) @@ -10821,7 +10834,7 @@ function runners.execute_script(fullname,internal) logs.simpleline() io.flush() end - local code = os.exec(command) -- maybe spawn + local code = os.exec(command) -- maybe spawn return code == 0 end end @@ -10855,7 +10868,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse +-- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -11096,22 +11109,35 @@ function runners.execute_ctx_script(filename,arguments) return true end else - logs.setverbose(true) - if filename == "" then - logs.simple("unknown script, no name given") + -- logs.setverbose(true) + if filename == "" or filename == "help" then local context = resolvers.find_file("mtx-context.lua") + logs.setverbose(true) if context ~= "" then local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } + table.sort(result) for _, scriptname in ipairs(result) do - scriptname = string.match(scriptname,".*mtx%-([^%-]-)%.lua") - if scriptname then - valid[#valid+1] = scriptname + local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + if scriptbase then + local data = io.loaddata(scriptname) + local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + if banner then + valid[#valid+1] = { scriptbase, version, banner } + end end end if #valid > 0 then - logs.simple("known scripts: %s",table.concat(valid,", ")) + logs.reportbanner() + logs.reportline() + logs.simple("no script name given, known scripts:") + logs.simple() + for k, v in ipairs(valid) do + logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + end end + else + logs.simple("no script name given") end else filename = file.addsuffix(filename,"lua") @@ -11125,6 +11151,7 @@ function runners.execute_ctx_script(filename,arguments) end end + function runners.timedrun(filename) -- just for me if filename and filename ~= "" then runners.timed(function() os.execute(filename) end) @@ -11152,7 +11179,9 @@ instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level -if environment.argument("usekpse") or environment.argument("forcekpse") then +local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename))] + +if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then os.setenv("engine","") os.setenv("progname","") @@ -11187,7 +11216,7 @@ if environment.argument("usekpse") or environment.argument("forcekpse") then return (kpse_initialized():show_path(name)) or "" end - elseif environment.argument("usekpse") then + elseif environment.argument("usekpse") or is_mkii_stub then resolvers.load() @@ -11222,7 +11251,10 @@ if trackspec then trackers.enable(trackspec) end -if environment.argument("selfmerge") then +if is_mkii_stub then + -- execute mkii script + ok = runners.execute_script(filename,false,true) +elseif environment.argument("selfmerge") then -- embed used libraries utils.merger.selfmerge(own.name,own.libs,own.list) elseif environment.argument("selfclean") then diff --git a/scripts/context/stubs/unix/mtxtools b/scripts/context/stubs/unix/mtxtools deleted file mode 100755 index 3803c1c6f..000000000 --- a/scripts/context/stubs/unix/mtxtools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute mtxtools.rb "$@" diff --git a/scripts/context/stubs/unix/pdftools b/scripts/context/stubs/unix/pdftools deleted file mode 100755 index da7bd64cf..000000000 --- a/scripts/context/stubs/unix/pdftools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute pdftools.rb "$@" diff --git a/scripts/context/stubs/unix/pstopdf b/scripts/context/stubs/unix/pstopdf deleted file mode 100755 index 059812cce..000000000 --- a/scripts/context/stubs/unix/pstopdf +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute pstopdf.rb "$@" diff --git a/scripts/context/stubs/unix/rlxtools b/scripts/context/stubs/unix/rlxtools deleted file mode 100755 index d01987b3c..000000000 --- a/scripts/context/stubs/unix/rlxtools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute rlxtools.rb "$@" diff --git a/scripts/context/stubs/unix/runtools b/scripts/context/stubs/unix/runtools deleted file mode 100755 index e21c1a244..000000000 --- a/scripts/context/stubs/unix/runtools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute runtools.rb "$@" diff --git a/scripts/context/stubs/unix/texexec b/scripts/context/stubs/unix/texexec index 083e500c6..cd5900ff8 100755 --- a/scripts/context/stubs/unix/texexec +++ b/scripts/context/stubs/unix/texexec @@ -1,2 +1,2 @@ #!/bin/sh -mtxrun --usekpse --execute texexec.rb "$@" +mtxrun --usekpse --execute texexec "$@" diff --git a/scripts/context/stubs/unix/texfont b/scripts/context/stubs/unix/texfont deleted file mode 100755 index bc811a640..000000000 --- a/scripts/context/stubs/unix/texfont +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute texfont.pl "$@" diff --git a/scripts/context/stubs/unix/textools b/scripts/context/stubs/unix/textools deleted file mode 100755 index 76087ca57..000000000 --- a/scripts/context/stubs/unix/textools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute textools.rb "$@" diff --git a/scripts/context/stubs/unix/texutil b/scripts/context/stubs/unix/texutil deleted file mode 100755 index f5d9b6f1d..000000000 --- a/scripts/context/stubs/unix/texutil +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute texutil.rb "$@" diff --git a/scripts/context/stubs/unix/tmftools b/scripts/context/stubs/unix/tmftools deleted file mode 100755 index 48d32f0fd..000000000 --- a/scripts/context/stubs/unix/tmftools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute tmftools.rb "$@" diff --git a/scripts/context/stubs/unix/xmltools b/scripts/context/stubs/unix/xmltools deleted file mode 100755 index a673d1e7a..000000000 --- a/scripts/context/stubs/unix/xmltools +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --usekpse --execute xmltools.rb "$@" diff --git a/tex/context/base/back-u3d.mkiv b/tex/context/base/back-u3d.mkiv new file mode 100644 index 000000000..398159feb --- /dev/null +++ b/tex/context/base/back-u3d.mkiv @@ -0,0 +1,156 @@ +%D \module +%D [ file=back-u3d, +%D version=2009.04.15, +%D title=\CONTEXT\ Backend Macros, +%D subtitle=U3D Experiment, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=\PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% This is only a placeholder that demonstrates the usage of u3d +% resources. The user interface is rather messy an might be +% improved. The files and setup is derived from an example by +% Michael Vidiassov. + +\endinput + +\starttext + +\startluaparameterset [u3d:myset:controls:1] + view = { + name = 'default', + bg = {1,1,1}, + mag = 100, + coo = {0,0,0}, + c2c = {0,0,1}, + rot = {40,0,60}, + roo = 6, + lights = 'CAD' + }, + js = 'cloudq.js' +\stopluaparameterset + +\startluaparameterset [u3d:myset:controls:2] + views = { + { + name = 'AnglePositioning', + bg = {1,1,1}, + azimuth = 45, + altitude = 45, + roo = 50, + aac = 2.5, + lights = 'Artwork' + }, + { + name = 'RotationPositioning', + bg = {1,1,1}, + rot = {0,45,45}, + roo = 50, + aac = 2.5, + lights = 'Artwork' + }, + { + name = 'VectorPositioning', + bg = {1,0,0}, + c2c = {1,1,math.sqrt(2)}, + roo = 50, + aac = 2.5, + lights = 'CAD' + }, + { + name = 'PositionPositioning', + bg = {1,0,0}, + pos = {1+25,1+25,1+50/math.sqrt(2)}, + aac = 2.5, + lights = 'CAD' + }, + { + name = 'ortho', + bg = {1,1,1}, + mag = 300, + lights = 'CAD', + crossection = {} + } + }, + view = { + name = 'default', + bg = {1,1,1}, + c2c = {-1,-1,0}, + roo = 50, + aac = 2.5, + roll = 45, + lights = 'CAD', + crossection = { + normal = {-1,-1,-1}, + transparent = true + }, + nodes = { + { + name = 'xlabel', + visible = false + }, + { + name = 'ylabel', + opacity = 0.5 + }, + { + name = 'zlabel', + rendermode = 'Wireframe' + } + } + } +\stopluaparameterset + +\useexternalfigure + [cloudq] + [cloudq.u3d] + [width=0.7\textwidth, + height=.7\textwidth, + display=u3d:myset:display:1, + controls=u3d:myset:controls:1] + +\useexternalfigure + [axes] + [axes.u3d] + [width=0.7\textwidth, + height=.7\textwidth, + controls=u3d:myset:controls:1] + +\startluaparameterset[u3d:myset:display:2] + toolbar = true, + preview = 'cloudq.png' +\stopluaparameterset +\startluaparameterset[u3d:myset:display:3] + toolbar = true, + tree = false, + preview = 'area.png' +\stopluaparameterset +\startluaparameterset[u3d:myset:display:4] + toolbar = true, + tree = false, + view = { + name = 'view', + bg = {0.1,0.1,0.1}, + c2c = {-1,-1,0}, + roo = 50, + aac = 2.5, + roll = 45, + lights = 'Red' + } +\stopluaparameterset +\startluaparameterset[u3d:myset:display:5] + toolbar = true, + tree = false, + view = 'ortho' +\stopluaparameterset + +\placefigure[here]{none}{\externalfigure[cloudq][display=u3d:myset:display:2]} +\placefigure[here]{none}{\externalfigure[axes] [display=u3d:myset:display:3]} +\placefigure[here]{none}{\externalfigure[axes] [display=u3d:myset:display:4]} +\placefigure[here]{none}{\externalfigure[axes] [display=u3d:myset:display:5,width=0.5\textwidth,height=.5\textwidth]} + +\stoptext diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 4373e668c..2f65224e0 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -277,7 +277,7 @@ \loadmarkfile{enco-pfr} \loadmarkfile{type-ini} -\loadmarkfile{type-def} +\loadmarkfile{type-set} %D Properties. Don't ask. diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 10f85ba59..23d578469 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -250,7 +250,7 @@ \loadmarkfile{typo-cap} \loadmarkfile{type-ini} -\loadmarkfile{type-def} +\loadmarkfile{type-set} \loadmarkfile{scrp-ini} diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index addd49fc0..d2c49e60c 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2009.11.26 16:28} +\edef\contextversion{2009.11.27 21:24} %D For those who want to use this: diff --git a/tex/context/base/font-cid.lua b/tex/context/base/font-cid.lua index 7165288cf..57bfcd378 100644 --- a/tex/context/base/font-cid.lua +++ b/tex/context/base/font-cid.lua @@ -78,10 +78,11 @@ end local template = "%s-%s-%s.cidmap" + local function locate(registry,ordering,supplement) local filename = format(template,registry,ordering,supplement) local hashname = lower(filename) - local cidmap = fonts.cid.map[hasnname] + local cidmap = fonts.cid.map[hashname] if not cidmap then if trace_loading then logs.report("load otf","checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename) diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index 63c5f214d..db8795253 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-os.lua @@ -102,6 +102,7 @@ function os.currentplatform(name,default) platform = "linux" end elseif name == "macosx" then + local architecture = os.resultof("echo $HOSTTYPE") if find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then diff --git a/tex/context/base/l-pdfview.lua b/tex/context/base/l-pdfview.lua index f74a7f04e..78dfb230b 100644 --- a/tex/context/base/l-pdfview.lua +++ b/tex/context/base/l-pdfview.lua @@ -12,22 +12,25 @@ pdfview = pdfview or { } local opencalls = { ['default'] = "pdfopen --file", -- "pdfopen --back --file" - ['okular'] = 'start "test" "c:/program files/kde/bin/okular.exe" --unique', -- todo: get focus ['xpdf'] = "xpdfopen", } local closecalls= { ['default'] = "pdfclose --file", - ['okular'] = nil, ['xpdf'] = nil, } local allcalls = { ['default'] = "pdfclose --all", - ['okular'] = nil, ['xpdf'] = nil, } +if os.platform == "windows" then + opencalls['okular'] = 'start "test" "c:/program files/kde/bin/okular.exe" --unique' -- todo: get focus +else + opencalls['okular'] = 'okular --unique' +end + pdfview.METHOD = "MTX_PDFVIEW_METHOD" pdfview.method = getenv(pdfview.METHOD) or 'default' pdfview.method = (opencalls[pdfview.method] and pdfview.method) or 'default' diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index 53c88e907..14d7af1c3 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -111,7 +111,12 @@ \else \edef\currentMPgraphicinstance{#1}% \fi - \edef\currentMPgraphicformat{\csname\@@MPF\currentMPgraphicinstance\s!format\endcsname}} + \edef\currentMPgraphicformat + {\ifcsname\@@MPF\currentMPgraphicinstance\s!format\endcsname + \csname\@@MPF\currentMPgraphicinstance\s!format\endcsname + \else + \defaultMPgraphicinstance + \fi}} \def\currentMPgraphicinstance{\defaultMPgraphicinstance} \def\currentMPgraphicformat {\currentMPgraphicinstance} diff --git a/tex/context/base/mult-cld.lua b/tex/context/base/mult-cld.lua index 02c57fe5f..406f3cb6e 100644 --- a/tex/context/base/mult-cld.lua +++ b/tex/context/base/mult-cld.lua @@ -159,11 +159,11 @@ function context.runfile(filename) local ok = dofile(filename) if type(ok) == "function" then if trace_cld then - commands.writestatus("cld","begin of file '%s' (funciton call)",filename) + commands.writestatus("cld","begin of file '%s' (function call)",filename) end ok() if trace_cld then - commands.writestatus("cld","end of file '%s' (funciton call)",filename) + commands.writestatus("cld","end of file '%s' (function call)",filename) end elseif ok then commands.writestatus("cld","file '%s' is processed and returns true",filename) diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex index 9105ce00a..7e1bf2d97 100644 --- a/tex/context/base/mult-sys.tex +++ b/tex/context/base/mult-sys.tex @@ -164,6 +164,14 @@ \definesystemconstant {mkii} \definesystemconstant {entities} +\definesystemconstant {normal} +\definesystemconstant {bold} +\definesystemconstant {italic} +\definesystemconstant {slanted} + +\definesystemconstant {default} +\definesystemconstant {smallcaps} + %D A more experienced \TEX\ user will recognize the next four %D constants. We need these because font-definitions are %D partially english. diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index 789cfbe43..3ec0537a7 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -941,7 +941,7 @@ \global\setbox\lastcolumnbox\vbox to \scratchdimen {\box\lastcolumnbox \vskip-\scratchdimen - box0}% + \box0}% \fi \egroup \fi diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv index 0246767b9..560001c6e 100644 --- a/tex/context/base/strc-not.mkiv +++ b/tex/context/base/strc-not.mkiv @@ -325,8 +325,8 @@ \setvalue{\??vn @\v!page }{\setnotelocation\plusone} \setvalue{\??vn @\v!columns }{\setnotelocation\plustwo} -\setvalue{\??vn @\v!firstcolumn}{\setnotelocation\plusthree} -\setvalue{\??vn @\v!lastcolumn }{\setnotelocation\plusfour} +\setvalue{\??vn @\v!lastcolumn }{\setnotelocation\plusthree} +\setvalue{\??vn @\v!firstcolumn}{\setnotelocation\plusfour} \setvalue{\??vn @\v!none }{\setnotelocation\plusfive} \setvalue{\??vn @\v!text }{\setnotelocation\plusfive \setnoteformatting\plusone} % test \setvalue{\??vn @\v!high }{\setnoteposition\plusone} diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index 324b11cf0..d50dadf6e 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['luat-log'] = { +if not modules then modules = { } end modules ['trac-log'] = { version = 1.001, comment = "companion to trac-log.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -275,8 +275,12 @@ end logs.simpleline = logs.reportline -function logs.help(message,option) +function logs.reportbanner() -- for scripts too logs.report(banner) +end + +function logs.help(message,option) + logs.reportbanner() logs.reportline() logs.reportlines(message) local moreinfo = logs.moreinfo or "" diff --git a/tex/context/base/type-def.mkii b/tex/context/base/type-def.mkii index 6469a5925..f31c93e50 100644 --- a/tex/context/base/type-def.mkii +++ b/tex/context/base/type-def.mkii @@ -11,55 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\definetypescriptprefix [serif] [Serif] -\definetypescriptprefix [sans] [Sans] -\definetypescriptprefix [mono] [Mono] - -\definefontsynonym [DefaultFont] [cmvtt10] - -\startsetups [font:fallback:serif] - \definefontsynonym [Serif] [DefaultFont] - \definefontsynonym [SerifBold] [Serif] - \definefontsynonym [SerifItalic] [Serif] - \definefontsynonym [SerifSlanted] [SerifItalic] - \definefontsynonym [SerifBoldItalic] [Serif] - \definefontsynonym [SerifBoldSlanted] [SerifBoldItalic] - \definefontsynonym [SerifCaps] [Serif] -\stopsetups - -\startsetups [font:fallback:sans] - \definefontsynonym [Sans] [DefaultFont] - \definefontsynonym [SansBold] [Sans] - \definefontsynonym [SansItalic] [Sans] - \definefontsynonym [SansSlanted] [SansItalic] - \definefontsynonym [SansBoldItalic] [Sans] - \definefontsynonym [SansBoldSlanted] [SansBoldItalic] - \definefontsynonym [SansCaps] [Sans] -\stopsetups - -\startsetups [font:fallback:mono] - \definefontsynonym [Mono] [DefaultFont] - \definefontsynonym [MonoBold] [Mono] - \definefontsynonym [MonoItalic] [Mono] - \definefontsynonym [MonoSlanted] [MonoItalic] - \definefontsynonym [MonoBoldItalic] [Mono] - \definefontsynonym [MonoBoldSlanted] [MonoBoldItalic] - \definefontsynonym [MonoCaps] [Mono] -\stopsetups - -\startsetups [font:allbold:serif] - \definefontsynonym [Serif] [SerifBold] - \definefontsynonym [SerifItalic] [SerifBoldItalic] - \definefontsynonym [SerifSlanted] [SerifBoldSlanted] - %definefontsynonym [SerifCaps] [SerifBold] -\stopsetups - -\startsetups [font:allbold:sans] - \definefontsynonym [Sans] [SansBold] - \definefontsynonym [SansItalic] [SansBoldItalic] - \definefontsynonym [SansSlanted] [SansBoldSlanted] - %definefontsynonym [SansCaps] [SansBold] -\stopsetups +\starttypescriptcollection[simplification] \starttypescript [serif] [simple] [name] \definefontsynonym [Serif] [Simple] @@ -91,6 +43,8 @@ \definefontsynonym [MonoCaps] [Mono] \stoptypescript +\stoptypescriptcollection + % handy % \starttypescript [serif] [simple] [name] @@ -98,31 +52,35 @@ % \setupfontsynonym [Simple] [handling=pure] % \stoptypescript +\starttypescriptcollection[handling-and-hz] + \starttypescript [serif,sans,mono] [handling,hanging] [pure,normal] - \setupfontsynonym [\typescriptprefix\typescriptone ] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone Bold] [handling=\typescriptthree bold] - \setupfontsynonym [\typescriptprefix\typescriptone Slanted] [handling=\typescriptthree slanted] - \setupfontsynonym [\typescriptprefix\typescriptone Italic] [handling=\typescriptthree italic] - \setupfontsynonym [\typescriptprefix\typescriptone BoldSlanted] [handling=\typescriptthree boldslanted] - \setupfontsynonym [\typescriptprefix\typescriptone BoldItalic] [handling=\typescriptthree bolditalic] + \setupfontsynonym [\typescriptprefix\typescriptone ] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone Bold] [handling=\typescriptthree bold] + \setupfontsynonym [\typescriptprefix\typescriptone Slanted] [handling=\typescriptthree slanted] + \setupfontsynonym [\typescriptprefix\typescriptone Italic] [handling=\typescriptthree italic] + \setupfontsynonym [\typescriptprefix\typescriptone BoldSlanted] [handling=\typescriptthree boldslanted] + \setupfontsynonym [\typescriptprefix\typescriptone BoldItalic] [handling=\typescriptthree bolditalic] \stoptypescript \starttypescript [serif,sans,mono] [handling,hz] [hz,quality,highquality] - \setupfontsynonym [\typescriptprefix\typescriptone ] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone Bold] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone Slanted] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone Italic] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone BoldSlanted] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone BoldItalic] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone ] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone Bold] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone Slanted] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone Italic] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone BoldSlanted] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone BoldItalic] [handling=\typescriptthree] \stoptypescript \starttypescript [serif,sans,mono] [handling] [noligs,prespacing,flexspacing] - \setupfontsynonym [\typescriptprefix\typescriptone ] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone Bold] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone Slanted] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone Italic] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone BoldSlanted] [handling=\typescriptthree] - \setupfontsynonym [\typescriptprefix\typescriptone BoldItalic] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone ] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone Bold] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone Slanted] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone Italic] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone BoldSlanted] [handling=\typescriptthree] + \setupfontsynonym [\typescriptprefix\typescriptone BoldItalic] [handling=\typescriptthree] \stoptypescript +\stoptypescriptcollection + \endinput diff --git a/tex/context/base/type-def.mkiv b/tex/context/base/type-def.mkiv index 748e3d66f..c980a4ee5 100644 --- a/tex/context/base/type-def.mkiv +++ b/tex/context/base/type-def.mkiv @@ -11,55 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\definetypescriptprefix [serif] [Serif] -\definetypescriptprefix [sans] [Sans] -\definetypescriptprefix [mono] [Mono] - -\definefontsynonym [DefaultFont] [cmvtt10] - -\startsetups [font:fallback:serif] - \definefontsynonym [Serif] [DefaultFont] - \definefontsynonym [SerifBold] [Serif] - \definefontsynonym [SerifItalic] [Serif] - \definefontsynonym [SerifSlanted] [SerifItalic] - \definefontsynonym [SerifBoldItalic] [Serif] - \definefontsynonym [SerifBoldSlanted] [SerifBoldItalic] - \definefontsynonym [SerifCaps] [Serif] -\stopsetups - -\startsetups [font:fallback:sans] - \definefontsynonym [Sans] [DefaultFont] - \definefontsynonym [SansBold] [Sans] - \definefontsynonym [SansItalic] [Sans] - \definefontsynonym [SansSlanted] [SansItalic] - \definefontsynonym [SansBoldItalic] [Sans] - \definefontsynonym [SansBoldSlanted] [SansBoldItalic] - \definefontsynonym [SansCaps] [Sans] -\stopsetups - -\startsetups [font:fallback:mono] - \definefontsynonym [Mono] [DefaultFont] - \definefontsynonym [MonoBold] [Mono] - \definefontsynonym [MonoItalic] [Mono] - \definefontsynonym [MonoSlanted] [MonoItalic] - \definefontsynonym [MonoBoldItalic] [Mono] - \definefontsynonym [MonoBoldSlanted] [MonoBoldItalic] - \definefontsynonym [MonoCaps] [Mono] -\stopsetups - -\startsetups [font:allbold:serif] - \definefontsynonym [Serif] [SerifBold] - \definefontsynonym [SerifItalic] [SerifBoldItalic] - \definefontsynonym [SerifSlanted] [SerifBoldSlanted] - %definefontsynonym [SerifCaps] [SerifBold] -\stopsetups - -\startsetups [font:allbold:sans] - \definefontsynonym [Sans] [SansBold] - \definefontsynonym [SansItalic] [SansBoldItalic] - \definefontsynonym [SansSlanted] [SansBoldSlanted] - %definefontsynonym [SansCaps] [SansBold] -\stopsetups +\starttypescriptcollection[simplification] \starttypescript [serif] [simple] [name] \definefontsynonym [Serif] [Simple] @@ -91,4 +43,6 @@ \definefontsynonym [MonoCaps] [Mono] \stoptypescript +\stoptypescriptcollection + \endinput diff --git a/tex/context/base/type-ini.mkii b/tex/context/base/type-ini.mkii index 9372f8dc3..e1a2d40a0 100644 --- a/tex/context/base/type-ini.mkii +++ b/tex/context/base/type-ini.mkii @@ -76,19 +76,6 @@ {\splitfiletype{#1}% \addtocommalist\splitoffname\typescriptfiles}} -\usetypescriptfile[\f!typeprefix tmf] -\usetypescriptfile[\f!typeprefix siz] - -\ifnum\texengine=\xetexengine - \usetypescriptfile[\f!typeprefix otf] - \usetypescriptfile[\f!typeprefix xtx] -\else - \usetypescriptfile[\f!typeprefix one] - %usetypescriptfile[\f!typeprefix akb] % we have gyre now -\fi - -\usetypescriptfile[\f!typeprefix loc] - % SO FAR \let\currenttypescripts\empty diff --git a/tex/context/base/type-ini.mkiv b/tex/context/base/type-ini.mkiv index 4076cf7b8..527a2771d 100644 --- a/tex/context/base/type-ini.mkiv +++ b/tex/context/base/type-ini.mkiv @@ -76,20 +76,6 @@ {\splitfiletype{#1}% \addtocommalist\splitoffname\typescriptfiles}} -% \usetypescriptfile[\f!typeprefix exa] % some examples -% \usetypescriptfile[\f!typeprefix syn] % font file synonyms -% \usetypescriptfile[\f!typeprefix enc] % files and encodings -% %usetypescriptfile[\f!typeprefix dis] % funny name remappings, obsolete -% \usetypescriptfile[\f!typeprefix siz] % specific font sizes -% \usetypescriptfile[\f!typeprefix map] % pdftex mapping -% \usetypescriptfile[\f!typeprefix spe] % special macros -% \usetypescriptfile[\f!typeprefix akb] % adobe karl berry names - -\usetypescriptfile[\f!typeprefix tmf] -\usetypescriptfile[\f!typeprefix siz] -\usetypescriptfile[\f!typeprefix otf] -\usetypescriptfile[\f!typeprefix loc] - % SO FAR \let\currenttypescripts\empty diff --git a/tex/context/base/type-lua.tex b/tex/context/base/type-lua.tex new file mode 100644 index 000000000..a6799671e --- /dev/null +++ b/tex/context/base/type-lua.tex @@ -0,0 +1,88 @@ +%D \module +%D [ file=type-lua, +%D version=2009.11.27, +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=\MKIV\ goodies, +%D author=Hans Hagen \& Wolfgang Schuster, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\starttypescriptcollection [luatex] + +\starttypescript [specserif] [all] [name] + \definefontsynonym [Serif] [spec:\cleanfontname\typescripttwo-\s!normal-\s!normal] [\s!features=\s!default] + \definefontsynonym [SerifItalic] [spec:\cleanfontname\typescripttwo-\s!normal-\s!italic] [\s!features=\s!default] + \definefontsynonym [SerifSlanted] [spec:\cleanfontname\typescripttwo-\s!normal-\s!italic] [\s!features=\s!default] + \definefontsynonym [SerifBold] [spec:\cleanfontname\typescripttwo-\s!bold -\s!normal] [\s!features=\s!default] + \definefontsynonym [SerifBoldItalic] [spec:\cleanfontname\typescripttwo-\s!bold -\s!italic] [\s!features=\s!default] + \definefontsynonym [SerifBoldSlanted] [spec:\cleanfontname\typescripttwo-\s!bold -\s!italic] [\s!features=\s!default] + \definefontsynonym [SerifCaps] [spec:\cleanfontname\typescripttwo-\s!normal-\s!normal] [\s!features=\s!smallcaps] +\stoptypescript + +\starttypescript [specsans] [all] [name] + \definefontsynonym [Sans] [spec:\cleanfontname\typescripttwo-\s!normal-\s!normal] [\s!features=\s!default] + \definefontsynonym [SansItalic] [spec:\cleanfontname\typescripttwo-\s!normal-\s!italic] [\s!features=\s!default] + \definefontsynonym [SansSlanted] [spec:\cleanfontname\typescripttwo-\s!normal-\s!italic] [\s!features=\s!default] + \definefontsynonym [SansBold] [spec:\cleanfontname\typescripttwo-\s!bold -\s!normal] [\s!features=\s!default] + \definefontsynonym [SansBoldItalic] [spec:\cleanfontname\typescripttwo-\s!bold -\s!italic] [\s!features=\s!default] + \definefontsynonym [SansBoldSlanted] [spec:\cleanfontname\typescripttwo-\s!bold -\s!italic] [\s!features=\s!default] + \definefontsynonym [SansCaps] [spec:\cleanfontname\typescripttwo-\s!normal-\s!normal] [\s!features=\s!smallcaps] +\stoptypescript + +\starttypescript [specmono] [all] [name] + \definefontsynonym [Mono] [spec:\cleanfontname\typescripttwo-\s!normal-\s!normal] [\s!features=\s!default] + \definefontsynonym [MonoItalic] [spec:\cleanfontname\typescripttwo-\s!normal-\s!italic] [\s!features=\s!default] + \definefontsynonym [MonoSlanted] [spec:\cleanfontname\typescripttwo-\s!normal-\s!italic] [\s!features=\s!default] + \definefontsynonym [MonoBold] [spec:\cleanfontname\typescripttwo-\s!bold -\s!normal] [\s!features=\s!default] + \definefontsynonym [MonoBoldItalic] [spec:\cleanfontname\typescripttwo-\s!bold -\s!italic] [\s!features=\s!default] + \definefontsynonym [MonoBoldSlanted] [spec:\cleanfontname\typescripttwo-\s!bold -\s!italic] [\s!features=\s!default] + \definefontsynonym [MonoCaps] [spec:\cleanfontname\typescripttwo-\s!normal-\s!normal] [\s!features=\s!smallcaps] +\stoptypescript + +% we could combine these in the normal serif settings + +\starttypescript [specserif] [default] [size] + \definebodyfont + [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt] [rm] + [\s!default] +\stoptypescript + +\starttypescript [specsans] [default] [size] + \definebodyfont + [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt] + [ss] [\s!default] +\stoptypescript + +\starttypescript [specmono] [default] [size] + \definebodyfont + [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt] + [tt] [\s!default] +\stoptypescript + +\starttypescript [specserif] [dtp] [size] + \definebodyfont + [5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,13pt,14pt,16pt,18pt,22pt,28pt] + [rm] [\s!default] +\stoptypescript + +\starttypescript [specsans] [dtp] [size] + \definebodyfont + [5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,13pt,14pt,16pt,18pt,22pt,28pt] + [ss] [\s!default] +\stoptypescript + +\starttypescript [specmono] [dtp] [size] + \definebodyfont + [5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,13pt,14pt,16pt,18pt,22pt,28pt] + [tt] [\s!default] +\stoptypescript + +\stoptypescriptcollection + +\protect \endinput diff --git a/tex/context/base/type-set.mkii b/tex/context/base/type-set.mkii new file mode 100644 index 000000000..eac9eb4c2 --- /dev/null +++ b/tex/context/base/type-set.mkii @@ -0,0 +1,81 @@ +%D \module +%D [ file=type-set, +%D version=2005.02.04, % moved from ini/def +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=Default Settings, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\definetypescriptprefix [serif] [Serif] +\definetypescriptprefix [sans] [Sans] +\definetypescriptprefix [mono] [Mono] + +\definefontsynonym [DefaultFont] [cmvtt10] + +\startsetups [font:fallback:serif] + \definefontsynonym [Serif] [DefaultFont] + \definefontsynonym [SerifBold] [Serif] + \definefontsynonym [SerifItalic] [Serif] + \definefontsynonym [SerifSlanted] [SerifItalic] + \definefontsynonym [SerifBoldItalic] [Serif] + \definefontsynonym [SerifBoldSlanted] [SerifBoldItalic] + \definefontsynonym [SerifCaps] [Serif] +\stopsetups + +\startsetups [font:fallback:sans] + \definefontsynonym [Sans] [DefaultFont] + \definefontsynonym [SansBold] [Sans] + \definefontsynonym [SansItalic] [Sans] + \definefontsynonym [SansSlanted] [SansItalic] + \definefontsynonym [SansBoldItalic] [Sans] + \definefontsynonym [SansBoldSlanted] [SansBoldItalic] + \definefontsynonym [SansCaps] [Sans] +\stopsetups + +\startsetups [font:fallback:mono] + \definefontsynonym [Mono] [DefaultFont] + \definefontsynonym [MonoBold] [Mono] + \definefontsynonym [MonoItalic] [Mono] + \definefontsynonym [MonoSlanted] [MonoItalic] + \definefontsynonym [MonoBoldItalic] [Mono] + \definefontsynonym [MonoBoldSlanted] [MonoBoldItalic] + \definefontsynonym [MonoCaps] [Mono] +\stopsetups + +\startsetups [font:allbold:serif] + \definefontsynonym [Serif] [SerifBold] + \definefontsynonym [SerifItalic] [SerifBoldItalic] + \definefontsynonym [SerifSlanted] [SerifBoldSlanted] + %definefontsynonym [SerifCaps] [SerifBold] +\stopsetups + +\startsetups [font:allbold:sans] + \definefontsynonym [Sans] [SansBold] + \definefontsynonym [SansItalic] [SansBoldItalic] + \definefontsynonym [SansSlanted] [SansBoldSlanted] + %definefontsynonym [SansCaps] [SansBold] +\stopsetups + +\ifnum\texengine=\xetexengine + \usetypescriptfile[\f!typeprefix def] + \usetypescriptfile[\f!typeprefix tmf] + \usetypescriptfile[\f!typeprefix siz] + \usetypescriptfile[\f!typeprefix otf] + \usetypescriptfile[\f!typeprefix xtx] + \usetypescriptfile[\f!typeprefix loc] +\else + \usetypescriptfile[\f!typeprefix def] + \usetypescriptfile[\f!typeprefix tmf] + \usetypescriptfile[\f!typeprefix siz] + \usetypescriptfile[\f!typeprefix one] + \usetypescriptfile[\f!typeprefix loc] +\fi + +\protect \endinput diff --git a/tex/context/base/type-set.mkiv b/tex/context/base/type-set.mkiv new file mode 100644 index 000000000..aa595db2f --- /dev/null +++ b/tex/context/base/type-set.mkiv @@ -0,0 +1,73 @@ +%D \module +%D [ file=type-set, +%D version=2005.02.04, % moved from ini/def +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=Default Settings, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\definetypescriptprefix [serif] [Serif] +\definetypescriptprefix [sans] [Sans] +\definetypescriptprefix [mono] [Mono] + +\definefontsynonym [DefaultFont] [cmvtt10] + +\startsetups [font:fallback:serif] + \definefontsynonym [Serif] [DefaultFont] + \definefontsynonym [SerifBold] [Serif] + \definefontsynonym [SerifItalic] [Serif] + \definefontsynonym [SerifSlanted] [SerifItalic] + \definefontsynonym [SerifBoldItalic] [Serif] + \definefontsynonym [SerifBoldSlanted] [SerifBoldItalic] + \definefontsynonym [SerifCaps] [Serif] +\stopsetups + +\startsetups [font:fallback:sans] + \definefontsynonym [Sans] [DefaultFont] + \definefontsynonym [SansBold] [Sans] + \definefontsynonym [SansItalic] [Sans] + \definefontsynonym [SansSlanted] [SansItalic] + \definefontsynonym [SansBoldItalic] [Sans] + \definefontsynonym [SansBoldSlanted] [SansBoldItalic] + \definefontsynonym [SansCaps] [Sans] +\stopsetups + +\startsetups [font:fallback:mono] + \definefontsynonym [Mono] [DefaultFont] + \definefontsynonym [MonoBold] [Mono] + \definefontsynonym [MonoItalic] [Mono] + \definefontsynonym [MonoSlanted] [MonoItalic] + \definefontsynonym [MonoBoldItalic] [Mono] + \definefontsynonym [MonoBoldSlanted] [MonoBoldItalic] + \definefontsynonym [MonoCaps] [Mono] +\stopsetups + +\startsetups [font:allbold:serif] + \definefontsynonym [Serif] [SerifBold] + \definefontsynonym [SerifItalic] [SerifBoldItalic] + \definefontsynonym [SerifSlanted] [SerifBoldSlanted] + %definefontsynonym [SerifCaps] [SerifBold] +\stopsetups + +\startsetups [font:allbold:sans] + \definefontsynonym [Sans] [SansBold] + \definefontsynonym [SansItalic] [SansBoldItalic] + \definefontsynonym [SansSlanted] [SansBoldSlanted] + %definefontsynonym [SansCaps] [SansBold] +\stopsetups + +\usetypescriptfile[\f!typeprefix def] +\usetypescriptfile[\f!typeprefix lua] +\usetypescriptfile[\f!typeprefix tmf] +\usetypescriptfile[\f!typeprefix siz] +\usetypescriptfile[\f!typeprefix otf] +\usetypescriptfile[\f!typeprefix loc] + +\protect \endinput diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 99f007a92..8fc59bc1f 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 11/26/09 16:35:22 +-- merge date : 11/27/09 21:28:10 do -- begin closure to overcome local limits and interference @@ -4226,10 +4226,11 @@ end local template = "%s-%s-%s.cidmap" + local function locate(registry,ordering,supplement) local filename = format(template,registry,ordering,supplement) local hashname = lower(filename) - local cidmap = fonts.cid.map[hasnname] + local cidmap = fonts.cid.map[hashname] if not cidmap then if trace_loading then logs.report("load otf","checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename) diff --git a/web2c/context.cnf b/web2c/context.cnf index 07ca3f7f5..e034ebe67 100644 --- a/web2c/context.cnf +++ b/web2c/context.cnf @@ -139,6 +139,8 @@ TEXMFSCRIPTS = .;$CTXDEVLUPATH;$TEXINPUTS;$CTXDEVRBPATH;$CTXDEVPLPATH;$TEXMF/s % PERLINPUTS = .;$CTXDEVJVPATH;$TEXMF/scripts/{$progname,$engine,}/perl % JAVAINPUTS = .;$CTXDEVJVPATH;$TEXMF/scripts/{$progname,$engine,}/java +CLUAINPUTS = .;$SELFAUTOLOC/lib/{$progname,$engine,}/lua// + % features shell_escape = t |