diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/attr-ini.lua | 8 | ||||
-rw-r--r-- | tex/context/base/back-pdf.lua | 3 | ||||
-rw-r--r-- | tex/context/base/buff-ini.lua | 50 | ||||
-rw-r--r-- | tex/context/base/colo-ini.lua | 135 | ||||
-rw-r--r-- | tex/context/base/colo-ini.mkiv | 22 | ||||
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/core-uti.lua | 5 | ||||
-rw-r--r-- | tex/context/base/grph-fig.mkiv | 55 | ||||
-rw-r--r-- | tex/context/base/grph-fil.lua | 42 | ||||
-rw-r--r-- | tex/context/base/grph-inc.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/page-imp.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/page-set.mkiv | 6 | ||||
-rw-r--r-- | tex/context/base/strc-mat.mkiv | 92 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 2 |
15 files changed, 277 insertions, 149 deletions
diff --git a/tex/context/base/attr-ini.lua b/tex/context/base/attr-ini.lua index 35c514ffe..26b050dc4 100644 --- a/tex/context/base/attr-ini.lua +++ b/tex/context/base/attr-ini.lua @@ -193,16 +193,20 @@ local function reviver(data,n) d = { gray, gray, gray, gray } logs.report("attributes","unable to revive color %s",n or "?") else - local kind, gray, rgb, cmyk = v[1], graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) + local kind = v[1] if kind == 2 then + local gray= graycolor(v[2]) d = { gray, gray, gray, gray } elseif kind == 3 then + local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) d = { rgb, gray, rgb, cmyk } elseif kind == 4 then + local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) d = { cmyk, gray, rgb, cmyk } elseif kind == 5 then local spot = spotcolor(v[10],v[11],v[12],v[13]) - d = { spot, gray, rgb, cmyk } + -- d = { spot, gray, rgb, cmyk } + d = { spot, spot, spot, spot } end end data[n] = d diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua index e3e3ebcda..b9e6b74ad 100644 --- a/tex/context/base/back-pdf.lua +++ b/tex/context/base/back-pdf.lua @@ -161,7 +161,7 @@ local pdf_indexed = pdfconstant("Indexed") local pdf_device_n = pdfconstant("DeviceN") local pdf_device_rgb = pdfconstant("DeviceRGB") local pdf_device_cmyk = pdfconstant("DeviceCMYK") -local pdf_device_gray = pdfconstant("Devicegray") +local pdf_device_gray = pdfconstant("DeviceGray") local pdf_extgstate = pdfconstant("ExtGState") local pdf_rbg_range = pdfarray { 0, 1, 0, 1, 0, 1 } @@ -302,6 +302,7 @@ local function indexcolorref(name) -- actually, names (parent) is the hash end function registrations.rgbspotcolor(name,noffractions,names,p,r,g,b) +--~ print(name,noffractions,names,p,r,g,b) if noffractions == 1 then registersomespotcolor(name,noffractions,names,p,pdf_device_rgb,pdf_rbg_range,format(rgb_function,r,g,b)) else diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index 7b304c27e..753c4a326 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -20,18 +20,20 @@ buffers.visualizers = { } -- if needed we can make 'm local +local trace_run = false trackers.register("buffers.run",function(v) trace_run = v end) + local utf = unicode.utf8 local concat, texsprint, texprint, texwrite = table.concat, tex.sprint, tex.print, tex.write local utfbyte, utffind, utfgsub = utf.byte, utf.find, utf.gsub local type, next = type, next local huge = math.huge -local byte, sub, find, char, gsub, rep, lower = string.byte, string.sub, string.find, string.char, string.gsub, string.rep, string.lower +local byte, sub, find, char, gsub, rep, lower, format = string.byte, string.sub, string.find, string.char, string.gsub, string.rep, string.lower, string.format local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues local ctxcatcodes = tex.ctxcatcodes local variables = interfaces.variables -local data, commands, flags, hooks, visualizers = buffers.data, buffers.commands, buffers.flags, buffers.hooks, buffers.visualizers +local data, flags, hooks, visualizers = buffers.data, buffers.flags, buffers.hooks, buffers.visualizers function buffers.raw(name) return data[name] or { } @@ -200,7 +202,7 @@ end -- The optional prefix hack is there for the typesetbuffer feature and -- in mkii we needed that (this hidden feature is used in a manual). -function buffers.save(name,list,encapsulate,optionalprefix) +local function prepared(name,list) if not name or name == "" then name = tex.jobname end @@ -210,14 +212,33 @@ function buffers.save(name,list,encapsulate,optionalprefix) list = name name = tex.jobname .. "-" .. name .. ".tmp" end - local content = buffers.collect(list,nil,optionalprefix) + local content = buffers.collect(list,nil) or "" if content == "" then content = "empty buffer" end - if encapsulate then - io.savedata(name, "\\starttext\n"..content.."\n\\stoptext\n") - else - io.savedata(name, content) + return name, content +end + +local capsule = "\\starttext\n%s\n\\stoptext\n" +local command = "context %s" + +function buffers.save(name,list,encapsulate) + local name, content = prepared(name,list) + io.savedata(name, (encapsulate and format(capsule,content)) or content) +end + +function buffers.run(name,list,encapsulate) + local name, content = prepared(name,list) + local data = io.loaddata(name) + content = (encapsulate and format(capsule,content)) or content + if data ~= content then + if trace_run then + commands.writestatus("buffers","changes in '%s', processing forced",name) + end + io.savedata(name,content) + os.execute(format(command,name)) + elseif trace_run then + commands.writestatus("buffers","no changes in '%s', not processed",name) end end @@ -236,8 +257,8 @@ function buffers.get(name) end end -local function content(name,separator,optionalprefix) -- no print - local b = data[name] or (optionalprefix and data[optionalprefix .. name]) +local function content(name,separator) -- no print + local b = data[name] if b then if type(b) == "table" then return concat(b,separator or "\n") @@ -251,20 +272,20 @@ end buffers.content = content -function buffers.collect(names,separator,optionalprefix) -- no print +function buffers.collect(names,separator) -- no print -- maybe we should always store a buffer as table so -- that we can pass if directly local t = { } if type(names) == "table" then for i=1,#names do - local c = content(names[i],separator,optionalprefix) + local c = content(names[i],separator) if c ~= "" then t[#t+1] = c end end else for name in names:gmatch("[^,%s]+") do - local c = content(name,separator,optionalprefix) + local c = content(name,separator) if c ~= "" then t[#t+1] = c end @@ -467,13 +488,14 @@ end -- special one -commands.nested = "\\switchslantedtype " +buffers.commands.nested = "\\switchslantedtype " -- todo : utf + faster, direct print and such. no \\char, vrb catcodes, see end function visualizers.flush_nested(str, enable) -- no utf, kind of obsolete mess str = str:gsub(" *[\n\r]+ *"," ") local result, c, nested, i = "", "", 0, 1 + local commands = buffers.commands -- otherwise wrong commands while i < #str do -- slow c = sub(str,i,i+1) if c == "<<" then diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua index 2aeefb6c6..fa667c453 100644 --- a/tex/context/base/colo-ini.lua +++ b/tex/context/base/colo-ini.lua @@ -11,6 +11,8 @@ local format, gmatch, gsub, lower, match = string.format, string.gmatch, string. local texsprint = tex.sprint local ctxcatcodes = tex.ctxcatcodes +local trace_define = false trackers.register("colors.define",function(v) trace_define = v end) + local settings_to_hash_strict = aux.settings_to_hash_strict colors = colors or { } @@ -23,91 +25,93 @@ local a_transparency = attributes.private('transparency') local a_colorspace = attributes.private('colormodel') local a_background = attributes.private('background') --- no format needed any more or maybe use low level commands (less tokenization) - -local a_l_c_template = "\\setevalue{(ca:%s)}{%s}" .. - "\\setevalue{(cs:%s)}{\\dosetattribute{color}{%s}}" -local a_g_c_template = "\\setxvalue{(ca:%s)}{%s}" .. - "\\setxvalue{(cs:%s)}{\\dosetattribute{color}{%s}}" -local f_l_c_template = "\\setvalue {(ca:%s)}{\\doinheritca{%s}}" .. - "\\setvalue {(cs:%s)}{\\doinheritcs{%s}}" -local f_g_c_template = "\\setgvalue{(ca:%s)}{\\doinheritca{%s}}" .. - "\\setgvalue{(cs:%s)}{\\doinheritcs{%s}}" -local r_l_c_template = "\\localundefine{(ca:%s)}" .. - "\\localundefine{(cs:%s)}" -local r_g_c_template = "\\globalundefine{(ca:%s)}" .. - "\\globalundefine{(cs:%s)}" - -local a_l_t_template = "\\setevalue{(ta:%s)}{%s}" .. - "\\setevalue{(ts:%s)}{\\dosetattribute{transparency}{%s}}" -local a_g_t_template = "\\setxvalue{(ta:%s)}{%s}" .. - "\\setxvalue{(ts:%s)}{\\dosetattribute{transparency}{%s}}" -local f_l_t_template = "\\setvalue {(ta:%s)}{\\doinheritta{%s}}" .. - "\\setvalue {(ts:%s)}{\\doinheritts{%s}}" -local f_g_t_template = "\\setgvalue{(ta:%s)}{\\doinheritta{%s}}" .. - "\\setgvalue{(ts:%s)}{\\doinheritts{%s}}" -local r_l_t_template = "\\localundefine{(ta:%s)}" .. - "\\localundefine{(ts:%s)}" -local r_g_t_template = "\\globalundefine{(ta:%s)}" .. - "\\globalundefine{(ts:%s)}" +local register_color = colors.register +local attributes_list = attributes.list local function definecolor(name, ca, global) if ca and ca > 0 then if global then - texsprint(ctxcatcodes,format(a_g_c_template, name, ca, name, ca)) + if trace_define then + commands.writestatus("color","define global color '%s' with attribute: %s",name,ca) + end + context.colordefagc(name,ca) -- texsprint(ctxcatcodes,"\\colordefagc{",name,"}{",ca,"}") else - texsprint(ctxcatcodes,format(a_l_c_template, name, ca, name, ca)) + if trace_define then + commands.writestatus("color","define local color '%s' with attribute: %s",name,ca) + end + context.colordefalc(name,ca) -- texsprint(ctxcatcodes,"\\colordefalc{",name,"}{",ca,"}") end else if global then - texsprint(ctxcatcodes,format(r_g_c_template, name, name)) + context.colordefrgc(name) -- texsprint(ctxcatcodes,"\\colordefrgc{",name,"}") else - texsprint(ctxcatcodes,format(r_l_c_template, name, name)) + context.colordefrlc(name) -- texsprint(ctxcatcodes,"\\colordefrlc{",name,"}") end end end + local function inheritcolor(name, ca, global) if ca and ca ~= "" then if global then - texsprint(ctxcatcodes,format(f_g_c_template, name, ca, name, ca)) + if trace_define then + commands.writestatus("color","inherit global color '%s' with attribute: %s",name,ca) + end + context.colordeffgc(name,ca) -- texsprint(ctxcatcodes,"\\colordeffgc{",name,"}{",ca,"}") else - texsprint(ctxcatcodes,format(f_l_c_template, name, ca, name, ca)) + if trace_define then + commands.writestatus("color","inherit local color '%s' with attribute: %s",name,ca) + end + context.colordefflc(name,ca) -- texsprint(ctxcatcodes,"\\colordefflc{",name,"}{",ca,"}") end else if global then - texsprint(ctxcatcodes,format(r_g_c_template, name, name)) + context.colordefrgc(name) -- texsprint(ctxcatcodes,"\\colordefrgc{",name,"}") else - texsprint(ctxcatcodes,format(r_l_c_template, name, name)) + context.colordefrlc(name) -- texsprint(ctxcatcodes,"\\colordefrlc{",name,"}") end end end + local function definetransparent(name, ta, global) if ta and ta > 0 then if global then - texsprint(ctxcatcodes,format(a_g_t_template, name, ta, name, ta)) + if trace_define then + commands.writestatus("color","define global transparency '%s' with attribute: %s",name,ta) + end + context.colordefagt(name,ta) -- texsprint(ctxcatcodes,"\\colordefagt{",name,"}{",ta,"}") else - texsprint(ctxcatcodes,format(a_l_t_template, name, ta, name, ta)) + if trace_define then + commands.writestatus("color","define local transparency '%s' with attribute: %s",name,ta) + end + context.colordefalt(name,ta) -- texsprint(ctxcatcodes,"\\colordefalt{",name,"}{",ta,"}") end else if global then - texsprint(ctxcatcodes,format(r_g_t_template, name, name)) + context.colordefrgt(name) -- texsprint(ctxcatcodes,"\\colordefrgt{",name,"}") else - texsprint(ctxcatcodes,format(r_l_t_template, name, name)) + context.colordefrlt(name) -- texsprint(ctxcatcodes,"\\colordefrlt{",name,"}") end end end + local function inherittransparent(name, ta, global) if ta and ta ~= "" then if global then - texsprint(ctxcatcodes,format(f_g_t_template, name, ta, name, ta)) + if trace_define then + commands.writestatus("color","inherit global transparency '%s' with attribute: %s",name,ta) + end + context.colordeffgt(name,ta) -- texsprint(ctxcatcodes,"\\colordeffgt{",name,"}{",ta,"}") else - texsprint(ctxcatcodes,format(f_l_t_template, name, ta, name, ta)) + if trace_define then + commands.writestatus("color","inherit local transparency '%s' with attribute: %s",name,ta) + end + context.colordefflt(name,ta) -- texsprint(ctxcatcodes,"\\colordefflt{",name,"}{",ta,"}") end else if global then - texsprint(ctxcatcodes,format(r_g_t_template, name, name)) + context.colordefrgt(name) -- texsprint(ctxcatcodes,"\\colordefrgt{",name,"}") else - texsprint(ctxcatcodes,format(r_l_t_template, name, name)) + context.colordefrlt(name) -- texsprint(ctxcatcodes,"\\colordefrlt{",name,"}") end end end @@ -180,7 +184,7 @@ local function do_registermultitonecolor(parent,name,parentnumber,e,f,d,p) -- sa end function colors.definesimplegray(name,s) - return colors.register(name,'gray',s) -- we still need to get rid of 'color' + return register_color(name,'gray',s) -- we still need to get rid of 'color' end function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent color vs transparent @@ -189,13 +193,13 @@ function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent if t then if t.h then local r, g, b = match(t.h .. "000000","(..)(..)(..)") -- watch the 255 - definecolor(name, colors.register(name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255 ), global) + definecolor(name, register_color(name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255 ), global) elseif t.r or t.g or t.b then - definecolor(name, colors.register(name,'rgb', tonumber(t.r) or 0, tonumber(t.g) or 0, tonumber(t.b) or 0 ), global) + definecolor(name, register_color(name,'rgb', tonumber(t.r) or 0, tonumber(t.g) or 0, tonumber(t.b) or 0 ), global) elseif t.c or t.m or t.y or t.k then - definecolor(name, colors.register(name,'cmyk',tonumber(t.c) or 0, tonumber(t.m) or 0, tonumber(t.y) or 0, tonumber(t.k) or 0), global) + definecolor(name, register_color(name,'cmyk',tonumber(t.c) or 0, tonumber(t.m) or 0, tonumber(t.y) or 0, tonumber(t.k) or 0), global) else - definecolor(name, colors.register(name,'gray',tonumber(t.s) or 0), global) + definecolor(name, register_color(name,'gray',tonumber(t.s) or 0), global) end if t.a and t.t then definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global) @@ -204,8 +208,8 @@ function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent definetransparent(name, 0, global) -- can be sped up end elseif freeze then - local ca = attributes.list[a_color] [str] - local ta = attributes.list[a_transparency][str] + local ca = attributes_list[a_color] [str] + local ta = attributes_list[a_transparency][str] if ca then definecolor(name, ca, global) end @@ -216,8 +220,8 @@ function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent inheritcolor(name, str, global) inherittransparent(name, str, global) -- if global and str ~= "" then -- For Peter Rolf who wants access to the numbers in Lua. (Currently only global is supported.) - -- attributes.list[a_color] [name] = attributes.list[a_color] [str] or attributes.unsetvalue -- reset - -- attributes.list[a_transparency][name] = attributes.list[a_transparency][str] or attributes.unsetvalue + -- attributes_list[a_color] [name] = attributes_list[a_color] [str] or attributes.unsetvalue -- reset + -- attributes_list[a_transparency][name] = attributes_list[a_transparency][str] or attributes.unsetvalue -- end end end @@ -231,16 +235,17 @@ function colors.definespotcolor(name,parent,str,global) if parent == "" or parent:find("=") then colors.registerspotcolor(name, parent) elseif name ~= parent then - local cp = attributes.list[a_color][parent] + local cp = attributes_list[a_color][parent] if cp then local t = settings_to_hash_strict(str) if t then - t.p = tonumber(t.p) or 1 - do_registerspotcolor(parent, name, cp, t.e, 1, "", t.p) -- p not really needed, only diagnostics + local tp = tonumber(t.p) or 1 + do_registerspotcolor(parent, name, cp, t.e, 1, "", tp) -- p not really needed, only diagnostics if name and name ~= "" then - definecolor(name, colors.register(name,'spot', parent, 1, "", t.p), true) - if t.a and t.t then - definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global) + definecolor(name, register_color(name,'spot', parent, 1, "", tp), true) + local ta, tt = t.a, t.t + if ta and tt then + definetransparent(name, transparencies.register(name,transparent[ta] or tonumber(ta) or 1,tonumber(tt) or 1), global) elseif colors.couple then --~ definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up definetransparent(name, 0, global) -- can be sped up @@ -252,7 +257,7 @@ function colors.definespotcolor(name,parent,str,global) end function colors.registerspotcolor(parent, str) - local cp = attributes.list[a_color][parent] + local cp = attributes_list[a_color][parent] if cp then local e = "" if str then @@ -277,11 +282,11 @@ function colors.definemultitonecolor(name,multispec,colorspec,selfspec) dd, pp, nn = concat(dd,','), concat(pp,','), concat(nn,'_') local parent = gsub(lower(nn),"[^%d%a%.]+","_") colors.defineprocesscolor(parent,colorspec..","..selfspec,true,true) - local cp = attributes.list[a_color][parent] + local cp = attributes_list[a_color][parent] if cp then do_registerspotcolor(parent, name, cp, "", nof, dd, pp) do_registermultitonecolor(parent, name, cp, "", nof, dd, pp) - definecolor(name, colors.register(name, 'spot', parent, nof, dd, pp), true) + definecolor(name, register_color(name, 'spot', parent, nof, dd, pp), true) local t = settings_to_hash_strict(selfspec) if t and t.a and t.t then definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global) @@ -430,13 +435,13 @@ function colors.defineintermediatecolor(name,fraction,c_one,c_two,a_one,a_two,sp -- problems with weighted gray conversions and work with original values local ca if csone == 2 then - ca = colors.register(name,'gray',f(one,two,2,fraction)) + ca = register_color(name,'gray',f(one,two,2,fraction)) elseif csone == 3 then - ca = colors.register(name,'rgb',f(one,two,3,fraction),f(one,two,4,fraction),f(one,two,5,fraction)) + ca = register_color(name,'rgb',f(one,two,3,fraction),f(one,two,4,fraction),f(one,two,5,fraction)) elseif csone == 4 then - ca = colors.register(name,'cmyk',f(one,two,6,fraction),f(one,two,7,fraction),f(one,two,8,fraction),f(one,two,9,fraction)) + ca = register_color(name,'cmyk',f(one,two,6,fraction),f(one,two,7,fraction),f(one,two,8,fraction),f(one,two,9,fraction)) else - ca = colors.register(name,'gray',f(one,two,2,fraction)) + ca = register_color(name,'gray',f(one,two,2,fraction)) end definecolor(name,ca,global,freeze) end diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv index 3890a77df..5f3cdf372 100644 --- a/tex/context/base/colo-ini.mkiv +++ b/tex/context/base/colo-ini.mkiv @@ -933,6 +933,28 @@ \def\doinheritta#1{\csname(ta:\ifcsname(ta:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ta:#1)\endcsname#1\fi\fi)\endcsname} \def\doinheritts#1{\csname(ts:\ifcsname(ts:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ts:#1)\endcsname#1\fi\fi)\endcsname} +%D Low level defs: ... \colorattribute#2 + +% \def\colordefalc#1#2{\setevalue{(ca:#1)}{#2}\setevalue{(cs:#1)}{\dosetattribute{color}{#2}}} +% \def\colordefagc#1#2{\setxvalue{(ca:#1)}{#2}\setevalue{(cs:#1)}{\dosetattribute{color}{#2}}} +% \def\colordefalt#1#2{\setevalue{(ta:#1)}{#2}\setevalue{(ts:#1)}{\dosetattribute{transparency}{#2}}} +% \def\colordefagt#1#2{\setxvalue{(ta:#1)}{#2}\setxvalue{(ts:#1)}{\dosetattribute{transparency}{#2}}} + +\def\colordefalc#1#2{\setevalue{(ca:#1)}{#2}\setvalue {(cs:#1)}{\attribute\colorattribute #2 }} +\def\colordefagc#1#2{\setxvalue{(ca:#1)}{#2}\setvalue {(cs:#1)}{\attribute\colorattribute #2 }} +\def\colordefalt#1#2{\setevalue{(ta:#1)}{#2}\setvalue {(ts:#1)}{\attribute\transparencyattribute#2 }} +\def\colordefagt#1#2{\setxvalue{(ta:#1)}{#2}\setgvalue{(ts:#1)}{\attribute\transparencyattribute#2 }} + +\def\colordefflc#1#2{\setvalue {(ca:#1)}{\doinheritca{#2}}\setvalue {(cs:#1)}{\doinheritcs{#2}}} +\def\colordeffgc#1#2{\setgvalue{(ca:#1)}{\doinheritca{#2}}\setvalue {(cs:#1)}{\doinheritcs{#2}}} +\def\colordefflt#1#2{\setvalue {(ta:#1)}{\doinheritta{#2}}\setvalue {(ts:#1)}{\doinheritts{#2}}} +\def\colordeffgt#1#2{\setgvalue{(ta:#1)}{\doinheritta{#2}}\setgvalue{(ts:#1)}{\doinheritts{#2}}} + +\def\colordefrlc #1{\localundefine {(ca:#1)}\localundefine {(cs:#1)}} +\def\colordefrgc #1{\globalundefine{(ca:#1)}\globalundefine{(cs:#1)}} +\def\colordefrlt #1{\localundefine {(ta:#1)}\localundefine {(ts:#1)}} +\def\colordefrgt #1{\globalundefine{(ta:#1)}\globalundefine{(ts:#1)}} + %D \macros %D {colorvalue, grayvalue} %D diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 547e0c325..64a039a69 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2009.11.09 17:47} +\newcontextversion{2009.11.10 13:30} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 23a718e90..8693887c9 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.09 17:47} +\edef\contextversion{2009.11.10 13:30} %D For those who want to use this: diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua index f381f2bb6..304920b57 100644 --- a/tex/context/base/core-uti.lua +++ b/tex/context/base/core-uti.lua @@ -57,11 +57,10 @@ end jobvariables = jobvariables or { } jobvariables.collected = jobvariables.collected or { } jobvariables.tobesaved = jobvariables.tobesaved or { } - jobvariables.checksums = jobvariables.checksums or { } -if not jobvariables.checksums.old then jobvariables.checksums.old = md5.HEX("old") end -if not jobvariables.checksums.new then jobvariables.checksums.new = md5.HEX("new") end +if not jobvariables.checksums.old then jobvariables.checksums.old = md5.HEX("old") end -- used in experiment +if not jobvariables.checksums.new then jobvariables.checksums.new = md5.HEX("new") end -- used in experiment job.register('jobvariables.checksums', jobvariables.checksums) diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv index ad71809bf..80dbefafd 100644 --- a/tex/context/base/grph-fig.mkiv +++ b/tex/context/base/grph-fig.mkiv @@ -433,41 +433,64 @@ \dodotypesetbuffer[\jobname][] \fi\fi} +% \def\dodotypesetbuffer[#1][#2]% +% {\bgroup +% \global\advance\noftypesetbuffers\plusone +% \edef\bufferfilename{\jobname-buffer-\the\noftypesetbuffers}% +% \doifmode{*\v!first} +% {\ctxlua{buffers.save("\bufferfilename.tmp","#1",true)}% +% \executesystemcommand{context \bufferfilename.tmp}}% +% \externalfigure[\bufferfilename.pdf][#2]% +% \egroup} + \def\dodotypesetbuffer[#1][#2]% {\bgroup \global\advance\noftypesetbuffers\plusone \edef\bufferfilename{\jobname-buffer-\the\noftypesetbuffers}% -% \iftrialtypesetting -% \externalfigure[\bufferfilename.pdf][#2]% -% \global\advance\noftypesetbuffers\minusone -% \else - \doifmode{*\v!first} - {\ctxlua{buffers.save("\bufferfilename.tmp","#1",true,"typeset-")}% - \executesystemcommand{context \bufferfilename.tmp}}% + \ctxlua{buffers.run("\bufferfilename.tmp","#1",true)}% \externalfigure[\bufferfilename.pdf][#2]% -% \fi \egroup} \def\dodotypesetbufferindeed#1% {} % for me only (manuals and such) +% +% \definetypesetting [name] [options] [settings-a] +% +% \typesetfile [name] [file] [settings-b] +% \typesetfile [file] [options] [settings-b] +% \typesetfile [file] [settings-b] +% \typesetfile [file] +% +% \enabletrackers[files.run] +% \starttext +% \typesetfile[oepsoeps.tex][width=10cm,frame=on] +% \stoptext \definesystemvariable{tz} \def\definetypesetting{\dotripleempty\dodefinetypesetting} \def\typesetfile {\dotripleempty\dotypesetfile} -\def\dodefinetypesetting[#1][#2][#3]% - {\doifsomething{#1}{\setvalue{\??tz#1}{\dodotypesetfile{#2}{#3}}}} +\def\definetypesetting{\dotripleempty\dodefinetypesetting} +\def\typesetfile {\dotripleempty\dotypesetfile} -\def\dotypesetfile[#1][#2][#3]% - {\executeifdefined{\??tz#1}\gobbletwoarguments{#2}{#3}} +\def\dodefinetypesetting[#1][#2][#3]% <name> options settings-a + {\doifsomething{#1}{\setvalue{\??tz#1}{\dodotypesetfile{#2}{#3}}}} -\def\dodotypesetfile#1#2#3#4% args settings file settings - {\doifmode{*\v!first}{\executesystemcommand{context #1 #3}}% - \doglobal\beforesplitstring#3\at.\to\typesetfilename - \externalfigure[\typesetfilename.pdf][#2,#4]} +\def\dotypesetfile[#1][#2][#3]% <name> filename settings-b | filename options settings + {\ifcsname\??tz#1\endcsname + \csname\??tz#1\endcsname{#2}{#3}% + \else\ifthirdargument % filename options settings + \dodotypesetfile{#2}{#3}{#1}{}% + \else\ifsecondargument % filename settings + \dodotypesetfile{}{#2}{#1}{}% + \fi\fi\fi} + +\def\dodotypesetfile#1#2#3#4% options settings-a filename settings-b + {\edef\typesetfilename{\ctxlua{tex.write(jobfiles.run("#3","#1"))}}% + \expanded{\externalfigure[\typesetfilename]}[#2,#4]} \setupexternalfigures [\c!option=, diff --git a/tex/context/base/grph-fil.lua b/tex/context/base/grph-fil.lua new file mode 100644 index 000000000..2e32c7a60 --- /dev/null +++ b/tex/context/base/grph-fil.lua @@ -0,0 +1,42 @@ +if not modules then modules = { } end modules ['grph-fil'] = { + version = 1.001, + comment = "companion to grph-fig.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format, concat = string.format, table.concat + +local trace_run = false trackers.register("files.run",function(v) trace_run = v end) + +local command = "context %s" + +jobfiles = jobfiles or { } +jobfiles.collected = jobfiles.collected or { } +jobfiles.tobesaved = jobfiles.tobesaved or { } + +local tobesaved, collected = jobfiles.tobesaved, jobfiles.collected + +local function initializer() + tobesaved, collected = jobfiles.tobesaved, jobfiles.collected +end + +job.register('jobfiles.collected', jobfiles.tobesaved, initializer) + +jobfiles.forcerun = false + +function jobfiles.run(name,...) + local oldchecksum = collected[name] + local newchecksum = file.checksum(name) + if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum then + if trace_run then + commands.writestatus("buffers","changes in '%s', processing forced",name) + end + os.execute(format(command,concat({ name, ... }," "))) + elseif trace_run then + commands.writestatus("buffers","no changes in '%s', not processed",name) + end + tobesaved[name] = newchecksum + return file.replacesuffix(name,"pdf") +end diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv index c2a0f2b49..c07e0d108 100644 --- a/tex/context/base/grph-inc.mkiv +++ b/tex/context/base/grph-inc.mkiv @@ -20,6 +20,7 @@ %D - a few more obscure things \registerctxluafile{grph-inc}{1.001} +\registerctxluafile{grph-fil}{1.001} \registerctxluafile{grph-u3d}{1.001} % this will change \unprotect diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv index fd0482585..684e3ba6b 100644 --- a/tex/context/base/page-imp.mkiv +++ b/tex/context/base/page-imp.mkiv @@ -387,6 +387,7 @@ \def\outputarrangedbox#1% {\bgroup + \forgetall % somehow we're back and need to redo this \gotonextarrangepage \ifnum\arrangedrotationO\arrangedrotationE>\zerocount \setbox#1\vbox diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 8dc8a2fd9..0fceea1c4 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -423,7 +423,7 @@ \localcolumnwidth\OTRSETlocalwidth\mofcolumns \offinterlineskip \setbox\scratchbox\vbox to \!!heighta - {\topskipcorrection % not needed + {%\topskipcorrection % not needed \ifcase\OTRSETbalancemethod % no \or @@ -2996,6 +2996,10 @@ \OTRSETdoflush \fi \egroup} + +\def\OTRSETdobalance% splitten in met en zonder footnotes + {\writestatus{columnsets}{balancing is not supported yet}% + \OTRSETnobalance} \protect \endinput diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index 0b8642814..a7b07f083 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -187,50 +187,52 @@ \let\currentsubformulasynchronize\relax \let\currentsubformulaattribute\relax \let\currentformulassynchronize \relax \let\currentformulasattribute \relax +\def\dohandleformulanumbering + {\doincrementsubstructurecounter[\v!formula][1]% + \doiftext\currentplaceformulasuffix{\setsubstructurecounterown[\v!formula][2]{\currentplaceformulasuffix}}% + \placecurrentformulanumber} + +\def\dohandlesubformulanumbering + {\doiftextelse\currentsubformulasuffix + {\setsubstructurecounterown[\v!formula][2]{\currentsubformulasuffix}} + {\doincrementsubstructurecounter[\v!formula][2]}% + \placecurrentformulanumber} + \def\dododoformulanumber {\ifconditional\handleformulanumber \hbox\bgroup % main counter - \doiftext \currentplaceformulasuffix {\setsubstructurecounterown[\v!formula][2]{\currentplaceformulasuffix}}% \ifconditional\insidesubformulas % nothing \else \ifcase\formulasnumbermode \ifcase\placeformulanumbermode - \doincrementsubstructurecounter[\v!formula][1]% - \placecurrentformulanumber + \dohandleformulanumbering \or - \doincrementsubstructurecounter[\v!formula][1]% - \placecurrentformulanumber + \dohandleformulanumbering \or % nothing \or - \doincrementsubstructurecounter[\v!formula][1]% - \placecurrentformulanumber + \dohandleformulanumbering \fi \or - \doincrementsubstructurecounter[\v!formula][1]% - \placecurrentformulanumber + \dohandleformulanumbering \or % nothing \or - \doincrementsubstructurecounter[\v!formula][1]% - \placecurrentformulanumber + \dohandleformulanumbering \fi \fi % subcounter - \doiftext \currentsubformulasuffix {\setsubstructurecounterown[\v!formula][2]{\currentsubformulasuffix}}% \ifconditional\insidesubformulas \ifcase\subformulasnumbermode % nothing \or - \doincrementsubstructurecounter[\v!formula][2]% - \placecurrentformulanumber + \dohandlesubformulanumbering \or % nothing \or - \doincrementsubstructurecounter[\v!formula][2]% - \placecurrentformulanumber + \dohandlesubformulanumbering \fi \fi %\rlap{\tracedformulamode}% @@ -633,40 +635,42 @@ \setfalse\incrementformulanumber \dodoubleempty\doplaceformula} -\def\placeformula - {\doglobal\settrue\insideplaceformula - \settrue\incrementformulanumber - \dodoubleempty\doplaceformula} - -\def\placesubformula - {\doglobal\settrue\insideplacesubformula - \setfalse\incrementformulanumber - \dodoubleempty\doplaceformula} +% \def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces +% {\def\currentplaceformulareference{#1}% +% \let\currentplaceformulasuffix\empty +% \futurelet\next\redoplaceformulaone} +% +% \let\mathdollarsign$ % no def +% +% \def\redoplaceformulaone % use doifnextcharelse +% {\ifx\next\bgroup +% \@EA\moreplaceformula % [ref]{} +% \else +% \@EA\redoplaceformulatwo +% \fi} +% +% \long\def\moreplaceformula#1#2% #1 dummy #1 gobbles spaces +% {\def\currentplaceformulasuffix{#1}% +% \futurelet\next\redoplaceformulatwo#2} +% +% \def\redoplaceformulatwo +% {\ifx\next\mathdollarsign +% \@EA\dispplaceformula % [ref]$$ +% \else +% \@EA\dodoplaceformula % [ref]\start +% \fi}% \def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces {\def\currentplaceformulareference{#1}% \let\currentplaceformulasuffix\empty - \futurelet\next\redoplaceformulaone} + \doifnextbgroupelse\moreplaceformula\redoplaceformula} % [ref]{} -\let\mathdollarsign$ % no def +\long\def\moreplaceformula#1% + {\def\currentplaceformulasuffix{#1}% + \redoplaceformula} -\def\redoplaceformulaone % use doifnextcharelse - {\ifx\next\bgroup - \@EA\moreplaceformula % [ref]{} - \else - \@EA\redoplaceformulatwo - \fi} - -\long\def\moreplaceformula#1#2#3% #1 dummy #3 gobbles spaces - {\def\currentplaceformulasuffix{#2}% - \futurelet\next\redoplaceformulatwo#3} - -\def\redoplaceformulatwo - {\ifx\next\mathdollarsign - \@EA\dispplaceformula % [ref]$$ - \else - \@EA\dodoplaceformula % [ref]\start - \fi}% +\long\def\redoplaceformula + {\doifnextcharelse$\dispplaceformula\dodoplaceformula} % [ref]$$ [ref]\start \def\dodoplaceformula {\handleplaceformulanumbering} diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index b86f16e21..c64942372 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/09/09 17:53:45 +-- merge date : 11/10/09 13:34:42 do -- begin closure to overcome local limits and interference |