diff options
25 files changed, 251 insertions, 164 deletions
diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index a32757b5c..642a20d93 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -900,12 +900,13 @@            \else              \MPy#1-\MPy#2-\MPy\textanchor+\MPy\textanchor+\MPh\textanchor            \fi -        \fi}% +        \fi +      \relax}%     \edef\textparwidth       {\the\dimexpr          \ifcase\scratchcounter            % one page -          \dimexpr\MPx#2-\MPx#1% +          \MPx#2-\MPx#1%          \else            % two or more pages / maybe also hang            \ifx#3\relax @@ -913,7 +914,8 @@            \else              \MPw\MPparanchor-\MPl\MPparanchor-\MPr\MPparanchor            \fi -        \fi}} +        \fi +      \relax}}  \def\mintextparheight{4\lineheight} diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua index c975c715a..dc10f8f1e 100644 --- a/tex/context/base/anch-pos.lua +++ b/tex/context/base/anch-pos.lua @@ -60,24 +60,25 @@ function jobpositions.MPh(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatco  function jobpositions.MPd(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[6]) or '0pt') end -    function jobpositions.MPx(id) -        local jpi = pcol[id] or ptbs[id] -        local x = jpi and jpi[2] -        if x then -            texprint(ctxcatcodes,format('\\the\\dimexpr %s-%s\\relax',x,dx)) -        else -            texprint(ctxcatcodes,'0pt') -        end +function jobpositions.MPx(id) +    local jpi = pcol[id] or ptbs[id] +    local x = jpi and jpi[2] +    if x then +        texprint(ctxcatcodes,format('\\the\\dimexpr%s-%s\\relax',x,dx)) -- no space after dimexpr ! +    else +        texprint(ctxcatcodes,'0pt')      end -    function jobpositions.MPy(id) -        local jpi = pcol[id] or ptbs[id] -        local y = jpi and jpi[3] -        if y then -            texprint(ctxcatcodes,format('\\the\\dimexpr %s-%s\\relax',y,dy)) -        else -            texprint(ctxcatcodes,'0pt') -        end +end + +function jobpositions.MPy(id) +    local jpi = pcol[id] or ptbs[id] +    local y = jpi and jpi[3] +    if y then +        texprint(ctxcatcodes,format('\\the\\dimexpr%s-%s\\relax',y,dy)) -- no space after dimexpr ! +    else +        texprint(ctxcatcodes,'0pt')      end +end  -- the following are only for MP so there we can leave out the pt diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv index 0ddda9af4..e454747da 100644 --- a/tex/context/base/anch-pos.mkiv +++ b/tex/context/base/anch-pos.mkiv @@ -205,18 +205,18 @@  % \the\dimexpr\noexpand\lastsavedpositionx\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax  % \the\dimexpr\noexpand\lastsavedpositiony\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax -\def\MPp       #1{\ctxlua{jobpositions.MPp("#1")}} -\def\MPx       #1{\ctxlua{jobpositions.MPx("#1")}} -\def\MPy       #1{\ctxlua{jobpositions.MPy("#1")}} -\def\MPw       #1{\ctxlua{jobpositions.MPw("#1")}} -\def\MPh       #1{\ctxlua{jobpositions.MPh("#1")}} -\def\MPd       #1{\ctxlua{jobpositions.MPd("#1")}} -\def\MPxy      #1{\ctxlua{jobpositions.MPxy("#1")}} -\def\MPll      #1{\ctxlua{jobpositions.MPll("#1")}} -\def\MPlr      #1{\ctxlua{jobpositions.MPlr("#1")}} -\def\MPur      #1{\ctxlua{jobpositions.MPur("#1")}} -\def\MPul      #1{\ctxlua{jobpositions.MPul("#1")}} -\def\MPpos     #1{\ctxlua{jobpositions.MPpos("#1")}} +\def\MPp  #1{\ctxlua{jobpositions.MPp("#1")}} +\def\MPx  #1{\ctxlua{jobpositions.MPx("#1")}} +\def\MPy  #1{\ctxlua{jobpositions.MPy("#1")}} +\def\MPw  #1{\ctxlua{jobpositions.MPw("#1")}} +\def\MPh  #1{\ctxlua{jobpositions.MPh("#1")}} +\def\MPd  #1{\ctxlua{jobpositions.MPd("#1")}} +\def\MPxy #1{\ctxlua{jobpositions.MPxy("#1")}} +\def\MPll #1{\ctxlua{jobpositions.MPll("#1")}} +\def\MPlr #1{\ctxlua{jobpositions.MPlr("#1")}} +\def\MPur #1{\ctxlua{jobpositions.MPur("#1")}} +\def\MPul #1{\ctxlua{jobpositions.MPul("#1")}} +\def\MPpos#1{\ctxlua{jobpositions.MPpos("#1")}}  %D \macros  %D  {MPplus, MPrest, MPv, MPvv} diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 5b751a632..ce16ac69a 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -100,39 +100,6 @@  % \def\loadallXfontmapfiles{\ctxlua{fonts.map.flush("pdftex")}} -% \ctxlua{ -%     do -%         local pth = "." .. io.fileseparator .. "tmp" .. io.fileseparator .. "\jobname" -%         texio.write_nl("CREATING "..pth) -%         os.execute("mkdir " .. pth) -%     end -%     resolvers.output_files = { } -%     callback.register('find_write_file', function(id,name) -%         resolvers.output_files[name] = file.join(".","tmp","\jobname",name) -%         texio.write_nl("REDIRECTING OUTPUT "..name.. " TO " .. resolvers.output_files[name]) -%         return resolvers.output_files[name] -%     end) -%     callback.register('find_read_file', function(id,name) -%         local sname = string.gsub(name,"^\letterpercent./","") -%         if resolvers.output_files[sname] then -%             return resolvers.output_files[name] -%         elseif string.find(sname,"^\jobname[\letterpercent.\letterpercent-]") then -%             local n = file.join(".","tmp","\jobname",sname) -%             local f = io.open(n) -%             if f then -%                 resolvers.output_files[name] = n -%                 texio.write_nl("REDIRECTING INPUT "..sname.. " TO " .. n) -%                 f:close() -%                 return n -%             else -%                 return resolvers.findtexfile(name) -%             end -%         else -%             return resolvers.findtexfile(name) -%         end -%     end) -% } -  \protect \endinput  % \expanded{\defineactivecharacter \number"2000E} {\textdir TRT\relax} diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua index 02369cc37..fcbbce1a3 100644 --- a/tex/context/base/font-def.lua +++ b/tex/context/base/font-def.lua @@ -644,5 +644,5 @@ end  <p>We overload both the <l n='tfm'/> and <l n='vf'/> readers.</p>  --ldx]]-- -callback.register('define_font' , define.read) -callback.register('find_vf_file', vf.find    ) -- not that relevant any more +callbacks.register('define_font' , define.read, "definition of fonts (tfmtable preparation)") +callbacks.register('find_vf_file', vf.find    , "locating virtual fonts, insofar needed") -- not that relevant any more diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 0588829ba..5b37aca05 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['lpdf-ini'] = {  -- This code is very experimental !  local setmetatable, getmetatable, type, next, tostring, tonumber, rawset = setmetatable, getmetatable, type, next, tostring, tonumber, rawset -local char, byte, format, gsub, concat, match = string.char, string.byte, string.format, string.gsub, table.concat, string.match +local char, byte, format, gsub, concat, match, sub = string.char, string.byte, string.format, string.gsub, table.concat, string.match, string.sub  local utfvalues = string.utfvalues  local texwrite = tex.write  local sind, cosd = math.sind, math.cosd @@ -142,9 +142,8 @@ tostring_a = function(t,contentonly,key)                  r[#r+1] = tosixteen(v)              elseif tv == "table" then                  local mv = getmetatable(v) -                local mt = mv.__lpdftype -                if mv and mt then ---~                 print(mv,mt,v) +                local mt = mv and mv.__lpdftype +                if mt then                      r[#r+1] = tostring(v)                  elseif v[1] then                      r[#r+1] = tostring_a(v) @@ -193,6 +192,7 @@ local function value_d(t)     return tostring_d(t,true,key) end -- the call is e  local function value_a(t)     return tostring_a(t,true,key) end -- the call is experimental  local function value_z()      return nil                    end -- the call is experimental  local function value_t()      return true                   end -- the call is experimental +local function value_f()      return false                  end -- the call is experimental  local function value_b()      return false                  end -- the call is experimental  local function value_r()      return t[1]                   end -- the call is experimental  local function value_v()      return t[1]                   end -- the call is experimental @@ -276,7 +276,7 @@ function lpdf.null()  end  function lpdf.boolean(b,default) -    if ((type(b) == boolean) and b) or default then +    if ((type(b) == "boolean") and b) or default then          return p_true      else          return p_false @@ -316,6 +316,14 @@ end  --~ local d = lpdf.dictionary()  --~ d["abcd"] = { 1, 2, 3, "test" }  --~ print(d) +--~ print(d()) + +--~ local d = lpdf.array() +--~ d[#d+1] = 1 +--~ d[#d+1] = 2 +--~ d[#d+1] = 3 +--~ d[#d+1] = "test" +--~ print(d)  --~ local d = lpdf.array()  --~ d[#d+1] = { 1, 2, 3, "test" } @@ -325,9 +333,14 @@ end  --~ d[#d+1] = { a=1, b=2, c=3, d="test" }  --~ print(d) ---~ local s = lpdf.boolean(false) +--~ local s = lpdf.constant("xx") +--~ print(s) -- fails somehow  --~ print(s()) -- fails somehow +--~ local s = lpdf.boolean(false) +--~ print(s) +--~ print(s()) +  function lpdf.checkedkey(t,key,kind)      local pn = t[key]      if pn then diff --git a/tex/context/base/lpdf-ini.mkiv b/tex/context/base/lpdf-ini.mkiv index d71206584..7c7dce3ef 100644 --- a/tex/context/base/lpdf-ini.mkiv +++ b/tex/context/base/lpdf-ini.mkiv @@ -38,7 +38,8 @@  %D  %D For drawing ovals we use quite raw \PDF\ code. The next  %D implementation does not differ that much from the one -%D implemented in the \POSTSCRIPT\ driver. +%D implemented in the \POSTSCRIPT\ driver. This code is +%D somewhat obsolete as we now have metapost embedded.  \def\doPDFovalcalc#1#2#3%    {\PointsToBigPoints{\dimexpr#1+#2\relax}#3} diff --git a/tex/context/base/luat-cbk.lua b/tex/context/base/luat-cbk.lua index 680a01c8f..cc2f8a354 100644 --- a/tex/context/base/luat-cbk.lua +++ b/tex/context/base/luat-cbk.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['luat-cbk'] = {      license   = "see context related readme files"  } +local insert, remove, find = table.insert, table.remove, string.find +  local trace_checking = false  trackers.register("memory.checking", function(v) trace_checking = v end)  --[[ldx-- @@ -14,8 +16,7 @@ your own code into the <l n='tex'/> engine. Here we implement a few handy  auxiliary functions.</p>  --ldx]]-- -callbacks       = { } -callbacks.stack = { } +callbacks = callbacks or { }  --[[ldx--  <p>When you (temporarily) want to install a callback function, and after a @@ -23,20 +24,112 @@ while wants to revert to the original one, you can use the following two  functions.</p>  --ldx]]-- +local trace_callbacks = false  trackers.register("system.callbacks", function(v) trace_callbacks = v end) + +local register_callback, find_callback = callback.register, callback.find +local frozen, stack = { }, { } + +local function frozenmessage(what,name) +    logs.report("callbacks","not %s frozen '%s' (%s)",what,name,frozen[name]) +end + +function callbacks.report() +    local list = callback.list() +    for name, func in table.sortedpairs(list) do +        local str = frozen[name] +        func = (func and "set") or "nop" +        if str then +            logs.report("callbacks","%s: %s -> %s",func,name,str) +        else +            logs.report("callbacks","%s: %s",func,name) +        end +    end +end + +function callbacks.table() +    context.starttabulate { "|l|l|p|" } +    for name, func in table.sortedpairs(callback.list()) do +        context.NC() +        context.type((func and "set") or "nop") +        context.NC() +        context.type(name) +        context.NC() +        context(frozen[name] or "") +        context.NC() +        context.NR() +    end +    context.stoptabulate() +end + +function callbacks.freeze(name,freeze) +    freeze = type(freeze) == "string" and freeze +--~ print(name) +    if find(name,"%*") then +        local pattern = name -- string.simpleesc(name) +        local list = callback.list() +        for name, func in pairs(list) do +            if find(name,pattern) then +                frozen[name] = freeze or frozen[name] or "frozen" +            end +        end +    else +        frozen[name] = freeze or frozen[name] or "frozen" +    end +end + +function callbacks.register(name,func,freeze) +    if frozen[name] then +        if trace_callbacks then +            frozenmessage("registering",name) +        end +    elseif freeze then +        frozen[name] = (type(freeze) == "string" and freeze) or "registered" +        register_callback(name,func) +    else +        register_callback(name,func) +    end +end + +function callback.register(name,func) -- original +    if not frozen[name] then +        register_callback(name,func) +    elseif trace_callbacks then +        frozenmessage("registering",name) +    end +end +  function callbacks.push(name, func) -    if not callbacks.stack[name] then -        callbacks.stack[name] = { } +    if not frozen[name] then +        local sn = stack[name] +        if not sn then +            sn = { } +            stack[name] = sn +        end +        insert(sn,find_callback(name)) +        register_callback(name, func) +    elseif trace_callbacks then +        frozenmessage("pushing",name)      end -    table.insert(callbacks.stack[name],callback.find(name)) -    callback.register(name, func)  end  function callbacks.pop(name) ---  this fails: callback.register(name, table.remove(callbacks.stack[name])) -    local func = table.remove(callbacks.stack[name]) -    callback.register(name, func) +    if frozen[name] then +        -- do nothing +    elseif #stack == 0 then +        -- some error +    else +     -- this fails: register_callback(name, remove(stack[name])) +        local func = remove(stack[name]) +        register_callback(name, func) +    end  end +--~ -- somehow crashes later on +--~ +--~ callbacks.freeze("find_.*_file","finding file") +--~ callbacks.freeze("read_.*_file","reading file") +--~ callbacks.freeze("open_.*_file","opening file") +  --[[ldx--  <p>The simple case is to remove the callback:</p> diff --git a/tex/context/base/luat-cnf.lua b/tex/context/base/luat-cnf.lua index ae132e4e6..e45aceb79 100644 --- a/tex/context/base/luat-cnf.lua +++ b/tex/context/base/luat-cnf.lua @@ -43,18 +43,18 @@ end  local stub = [[  -- checking -storage = storage or {} -luatex  = luatex  or {} - --- as soon as possible - -luatex.starttime = os.gettimeofday() +storage = storage or { } +luatex  = luatex  or { }  -- we provide our own file handling  texconfig.kpse_init = false  texconfig.shell_escape = 't' +-- as soon as possible + +luatex.starttime = os.gettimeofday() +  -- this will happen after the format is loaded  function texconfig.init() diff --git a/tex/context/base/luat-dum.lua b/tex/context/base/luat-dum.lua index ceda2d923..19e95e2b1 100644 --- a/tex/context/base/luat-dum.lua +++ b/tex/context/base/luat-dum.lua @@ -42,6 +42,9 @@ tasks = {      appendaction  = dummyfunction,      prependaction = dummyfunction,  } +callbacks = { +    register = function(n,f) return callback.register(n,f) end, +}  -- we need to cheat a bit here diff --git a/tex/context/base/luat-fio.lua b/tex/context/base/luat-fio.lua index 334297f03..0209fc243 100644 --- a/tex/context/base/luat-fio.lua +++ b/tex/context/base/luat-fio.lua @@ -42,7 +42,7 @@ if not resolvers.instance then          callback.register('find_map_file'       , function(name) return resolvers.findbinfile(name,"map") end)          callback.register('find_ocp_file'       , function(name) return resolvers.findbinfile(name,"ocp") end)          callback.register('find_opentype_file'  , function(name) return resolvers.findbinfile(name,"otf") end) -        callback.register('find_output_file'    , function(name) return name                          end) +        callback.register('find_output_file'    , function(name) return name                              end)          callback.register('find_pk_file'        , function(name) return resolvers.findbinfile(name,"pk")  end)          callback.register('find_sfd_file'       , function(name) return resolvers.findbinfile(name,"sfd") end)          callback.register('find_truetype_file'  , function(name) return resolvers.findbinfile(name,"ttf") end) diff --git a/tex/context/base/luat-run.lua b/tex/context/base/luat-run.lua index 44126f526..f2072f74a 100644 --- a/tex/context/base/luat-run.lua +++ b/tex/context/base/luat-run.lua @@ -61,9 +61,9 @@ end  -- this can be done later -callback.register('start_run',           main.start) -callback.register('stop_run',            main.stop) -callback.register('report_output_pages', main.report_output_pages) -callback.register('report_output_log'  , main.report_output_log) -callback.register('start_page_number'  , main.start_shipout_page) -callback.register('stop_page_number'   , main.stop_shipout_page) +callbacks.register('start_run',           main.start, "actions performed at the beginning of a run") +callbacks.register('stop_run',            main.stop, "actions performed at the end of a run") +callbacks.register('report_output_pages', main.report_output_pages, "actions performed when reporting pages") +callbacks.register('report_output_log'  , main.report_output_log, "actions performed when reporting log file") +callbacks.register('start_page_number'  , main.start_shipout_page, "actions performed at the beginning of a shipout") +callbacks.register('stop_page_number'   , main.stop_shipout_page, "actions performed at the end of a shipout") diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index b226444a4..cca1812d2 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -358,7 +358,7 @@ function nodes.processors.mlist_to_hlist(head,style,penalties)      return head, done  end -callback.register('mlist_to_hlist',nodes.processors.mlist_to_hlist) +callbacks.register('mlist_to_hlist',nodes.processors.mlist_to_hlist,"preprocessing math list")  -- tracing diff --git a/tex/context/base/node-pro.lua b/tex/context/base/node-pro.lua index 8b2e92ff2..b294b850f 100644 --- a/tex/context/base/node-pro.lua +++ b/tex/context/base/node-pro.lua @@ -108,8 +108,8 @@ function nodes.processors.hpack_filter(head,groupcode)      return true  end -callback.register('pre_linebreak_filter', nodes.processors.pre_linebreak_filter) -callback.register('hpack_filter'        , nodes.processors.hpack_filter) +callbacks.register('pre_linebreak_filter', nodes.processors.pre_linebreak_filter,"all kind of horizontal manipulations (before par break)") +callbacks.register('hpack_filter'        , nodes.processors.hpack_filter,"all kind of horizontal manipulations")  local actions = tasks.actions("finalizers",2) -- head, where, boolean @@ -142,7 +142,7 @@ function nodes.processors.post_linebreak_filter(head,groupcode)  --~     return true  end -callback.register('post_linebreak_filter', nodes.processors.post_linebreak_filter) +callbacks.register('post_linebreak_filter', nodes.processors.post_linebreak_filter,"all kind of horizontal manipulations (after par break)")  statistics.register("h-node processing time", function()      if statistics.elapsedindeed(nodes) then diff --git a/tex/context/base/node-tex.lua b/tex/context/base/node-tex.lua index c5781ab5a..a6eef3269 100644 --- a/tex/context/base/node-tex.lua +++ b/tex/context/base/node-tex.lua @@ -34,6 +34,6 @@ function kernel.kerning(head)      return head, done  end -callback.register('hyphenate' , false) -callback.register('ligaturing', false) -callback.register('kerning'   , false) +callbacks.register('hyphenate' , false, "normal hyphenation routine, called elsewhere") +callbacks.register('ligaturing', false, "normal ligaturing routine, called elsewhere") +callbacks.register('kerning'   , false, "normal kerning routine, called elsewhere") diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv index 8c7144a48..2e3703eae 100644 --- a/tex/context/base/page-lin.mkiv +++ b/tex/context/base/page-lin.mkiv @@ -476,8 +476,7 @@      \ctxlua{          nodes.lines.scratchbox = \number\linenumberscratchbox ; -    %   callback.register('vpack_filter', nodes.lines.flowed.apply) -        callback.register('post_linebreak_filter', nodes.lines.flowed.apply) +     -- register nodes.lines.flowed.apply in post_linebreak_filter actions      }  \fi diff --git a/tex/context/base/scrn-hlp.mkiv b/tex/context/base/scrn-hlp.mkiv index c9fcbd29a..4eaa340ca 100644 --- a/tex/context/base/scrn-hlp.mkiv +++ b/tex/context/base/scrn-hlp.mkiv @@ -38,6 +38,9 @@  \newcounter     \nofhelpdataentries  \newconditional \somehelpdatadefined +\let\getpagehelpdata        \relax +\let\synchronizepagehelpdata\relax +  \appendtoks \getpagehelpdata         \to \beforeeverypage  \appendtoks \synchronizepagehelpdata \to \aftereverypage @@ -46,43 +49,48 @@  \let\pagehelpdata\empty  \def\dontresetpagedata -  {\let\synchronizepagehelpdata\relax} +  {\let\synchronizepagehelpdataindeed\relax}  \def\resetpagehelpdata    {\iflocation -     \let\synchronizepagehelpdata\resetpagehelpdata +     \let\synchronizepagehelpdataindeed\resetpagehelpdata       \global\let\pagehelpdata\empty       \resetreference[HideHelp]%     \fi} -\let\synchronizepagehelpdata\resetpagehelpdata +\let\synchronizepagehelpdataindeed\resetpagehelpdata  \resetreference[HideHelp] -\def\getpagehelpdata +\def\getpagehelpdataindeed    {\iflocation\ifcase\nofhelpdataentries\else -     \let\pagehelpdata\empty -     \ifconditional\somehelpdatadefined -       \definetwopasslist{hlp:\realfolio}% -       \doloop -         {\gettwopassdata{hlp:\realfolio}% -          \iftwopassdatafound -            \addtocommalist\twopassdata\pagehelpdata -          \else -            \exitloop -          \fi}% -     \fi -     \ifx\pagehelpdata\empty \else -       \useJSscripts[fld]% -       \definereference[HideHelp][JS(Hide_Fields)]% for the moment -     \fi +     \dogetpagehelpdataindeed     \fi\fi} +\def\dogetpagehelpdataindeed +  {\let\pagehelpdata\empty +   \ifconditional\somehelpdatadefined +     \definetwopasslist{hlp:\realfolio}% +     \doloop +       {\gettwopassdata{hlp:\realfolio}% +        \iftwopassdatafound +          \addtocommalist\twopassdata\pagehelpdata +        \else +          \exitloop +        \fi}% +   \fi +   \ifx\pagehelpdata\empty \else +     \useJSscripts[fld]% +     \definereference[HideHelp][JS(Hide_Fields)]% for the moment +   \fi} +  \def\setpagehelpdata[#1]%    {\iflocation\expanded{\dosetpagehelpdata{#1}}\fi}  \def\dosetpagehelpdata#1%    {\doglobal\increment\nofhelpdataentries +   \global\let\getpagehelpdata\getpagehelpdataindeed +   \global\let\synchronizepagehelpdata\synchronizepagehelpdataindeed     \savetwopassdata{hlp:\realfolio}{\nofhelpdataentries}{#1}}  \setvalue{\e!start\v!helptext}[#1]% diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index fca5624ec..a6754937b 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -812,12 +812,12 @@  \installspacehandler \v!on    {\obeyspaces -   \def\obeyedspace{\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}}% +   \unexpanded\def\obeyedspace{\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}}%     \let\ =\obeyedspace}  \installspacehandler \v!yes    {\obeyspaces -   \def\obeyedspace{\mathortext\normalspace{\dontleavehmode\normalspace}}% +   \unexpanded\def\obeyedspace{\mathortext\normalspace{\dontleavehmode\normalspace}}%     \let\ =\obeyedspace}  \installspacehandler \v!off % == default @@ -827,10 +827,14 @@  \installspacehandler \v!fixed    {\obeyspaces -   \def\obeyedspace{\mathortext\normalspace{\dontleavehmode\fixedspace}}% +   \unexpanded\def\obeyedspace{\mathortext\normalspace{\dontleavehmode\fixedspace}}%     \let\ =\obeyedspace}  \def\activatespacehandler#1%    {\executeifdefined{\??sr#1}{\activatespacehandler\v!off}} +\appendtoks +   \normalspaces % to be sure +\to \everybeforeoutput +  \protect \endinput diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 735ebbdde..3bfc84a19 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -1001,9 +1001,9 @@ local ignore = table.tohash {  function nodes.handle_vbox_spacing(head,where)      if head and not ignore[where] and head.next then ---~         starttiming(vspacing) +    --  starttiming(vspacing)          head = collapser(head,"vbox",where,trace_vbox_vspacing,false) ---~         stoptiming(vspacing) +    --  stoptiming(vspacing)      end      return head  end @@ -1011,27 +1011,12 @@ end  function nodes.collapse_vbox(n) -- for boxes      local list = texbox[n].list      if list then ---~         starttiming(vspacing) +    --  starttiming(vspacing)          texbox[n].list = vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true)) ---~         stoptiming(vspacing) +    --  stoptiming(vspacing)      end  end --- these are experimental callback definitions that definitely will --- be moved elsewhere as part of a chain of vnode handling --- ---  function vspacing.enable() ---      callback.register('vpack_filter', nodes.handle_vbox_spacing) -- enabled per 2009/10/16 ---      callback.register('buildpage_filter', nodes.handle_page_spacing) ---  end --- ---  function vspacing.disable() ---      callback.register('vpack_filter', nil) ---      callback.register('buildpage_filter', nil) ---  end --- ---  vspacing.enable() -  -- we will split this module hence the locals  local attribute = attributes.private('graphicvadjust') @@ -1127,8 +1112,8 @@ function nodes.builders.buildpage_filter(groupcode)      return (done and head) or true  end -callback.register('vpack_filter',     nodes.builders.vpack_filter) -callback.register('buildpage_filter', nodes.builders.buildpage_filter) +callbacks.register('vpack_filter',     nodes.builders.vpack_filter,"vertical spacing etc") +callbacks.register('buildpage_filter', nodes.builders.buildpage_filter,"vertical spacing etc (mvl)")  statistics.register("v-node processing time", function()      if statistics.elapsedindeed(builders) then diff --git a/tex/context/base/strc-def.mkiv b/tex/context/base/strc-def.mkiv index 7f1db7065..0ef59b300 100644 --- a/tex/context/base/strc-def.mkiv +++ b/tex/context/base/strc-def.mkiv @@ -120,7 +120,7 @@  \definestructureseparatorset  [\v!appendix:\s!default] [] [.]  \definestructureconversionset [\v!appendix:\s!default] [Romannumerals,Characters] [numbers] -\definestructureresetset      [\v!appendix:\s!default] [] [0] +\definestructureresetset      [\v!appendix:\s!default] [] [1] % why was this 0  % \definesectionblock diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua index 95246bff7..60d00f8b2 100644 --- a/tex/context/base/strc-reg.lua +++ b/tex/context/base/strc-reg.lua @@ -295,8 +295,9 @@ function jobregisters.compare(a,b)      for i=1,max do          if result == 0 then              result = compare(ea[i],eb[i]) +        else +            break          end -        return result      end      if result ~= 0 then          return result @@ -495,6 +496,7 @@ function jobregisters.flush(data,options,prefixspec,pagespec)              local kind = entry.metadata.kind              if kind == 'entry' then                  texsprint(ctxcatcodes,"\\startregisterpages") +--~ collapse_ranges = true                  if collapse_singles or collapse_ranges then                      -- we collapse ranges and keep existing ranges as they are                      -- so we get prebuilt as well as built ranges diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index d807b2939..4fa29285a 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -476,7 +476,7 @@     \fi     \setnextinternalreference     % we could consider storing register entries in list -   \ctxlua{ jobregisters.store { +   \edef\temp{\ctxlua{ jobregisters.store {          metadata = {              kind     = "see",              name     = "\currentregister", @@ -495,7 +495,7 @@              text = "\currentregisterseeword"          },       } -   }% +   }}%     \endgroup}  %D Rendering: @@ -599,9 +599,9 @@  % test case for collapsing (experimental, for Steffen Wolfrum)  %  % \starttext -% \placeregister[index][collapse=no]  \blank[2*big] -% \placeregister[index][collapse=yes] \blank[2*big] -% \placeregister[index][collapse=akk] \page +% \placeregister[index][compress=no]  \blank[2*big] +% \placeregister[index][compress=yes] \blank[2*big] +% \placeregister[index][compress=all] \page  % \dorecurse{10}{test 1:!\index{test} test \page}  % \dorecurse{5} {test 2:\recurselevel      \page}  % \dorecurse{10}{test 3:!\index{test} test \page} diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index ec7d97e6d..f583ef849 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -557,11 +557,13 @@  \newconditional\ignorehandlepagebreak  \def\dostructureheadspacingbeforeyes -  {\docheckstructureheadbefore\dohandlestructureheadpagebreak +  {\docheckstructureheadbefore +   \dohandlestructureheadpagebreak     \structureheadparameter\c!inbetween}  \def\dostructureheadspacingbeforenop -  {\docheckstructureheadbefore\docheckstructureheadlayout +  {\docheckstructureheadbefore +   \docheckstructureheadlayout     \structureheadparameter\c!inbetween}  % \def\emptystructureheadcorrection @@ -635,7 +637,7 @@       \setfalse\ignorehandlepagebreak     \else       \ifnum\lastpenalty>\zerocount -       \global\pagebreakdisabledtrue +%        \global\pagebreakdisabledtrue       \fi       % beware, these numbers are not yet know here       \doifelse{\structureheadparameter\c!continue}\v!yes @@ -648,11 +650,11 @@       \doifnot{\structureheadparameter\c!aligntitle}\v!float\flushsidefloats       \structureheadparameter\c!before       \relax -     \ifpagebreakdisabled -       \global\pagebreakdisabledfalse -     \else +%      \ifpagebreakdisabled +%        \global\pagebreakdisabledfalse +%      \else         \dopreventbreakafterstructureheadauto -     \fi +%      \fi       \doif{\structureheadparameter\c!aligntitle}\v!float\indent       \global\precedingstructurelevel\currentstructureheadlevel     \fi} diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index 816fb83df..c98d76aeb 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -86,3 +86,7 @@ tasks.disableaction("shipouts",   "nodes.add_references")  tasks.disableaction("shipouts",   "nodes.add_destinations")  tasks.disableaction("pagebuilders", "nodes.migrate_outwards") + +callbacks.freeze("find_.*_file", "find file using resolver") +callbacks.freeze("read_.*_file", "read file at once") +callbacks.freeze("open_.*_file", "open file for reading") diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index d7b687b7c..c54df5f47 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  : 02/15/10 22:19:32 +-- merge date  : 02/17/10 14:29:47  do -- begin closure to overcome local limits and interference @@ -1975,6 +1975,9 @@ tasks = {      appendaction  = dummyfunction,      prependaction = dummyfunction,  } +callbacks = { +    register = function(n,f) return callback.register(n,f) end, +}  -- we need to cheat a bit here @@ -11640,8 +11643,8 @@ end  <p>We overload both the <l n='tfm'/> and <l n='vf'/> readers.</p>  --ldx]]-- -callback.register('define_font' , define.read) -callback.register('find_vf_file', vf.find    ) -- not that relevant any more +callbacks.register('define_font' , define.read, "definition of fonts (tfmtable preparation)") +callbacks.register('find_vf_file', vf.find    , "locating virtual fonts, insofar needed") -- not that relevant any more  end -- closure  | 
