summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/cldf-bas.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/cldf-bas.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/cldf-bas.lua155
1 files changed, 33 insertions, 122 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/cldf-bas.lua b/Master/texmf-dist/tex/context/base/mkiv/cldf-bas.lua
index f55132a0612..07054663708 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/cldf-bas.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/cldf-bas.lua
@@ -22,38 +22,27 @@ if not modules then modules = { } end modules ['cldf-bas'] = {
-- flush(ctxcatcodes,"}")
-- end
-local tonumber = tonumber
-local type = type
-local format = string.format
-local utfchar = utf.char
-local concat = table.concat
+local tonumber = tonumber
+local type = type
+local format = string.format
+local utfchar = utf.char
+local concat = table.concat
-local context = context
-local ctxcore = context.core
+local context = context
+local ctxcore = context.core
+local variables = interfaces.variables
-local variables = interfaces.variables
+local nodepool = nodes.pool
+local new_rule = nodepool.rule
+local new_glyph = nodepool.glyph
+local current_attr = nodes.current_attr
-local ctx_flushnode = context.nuts.flush
-
-local nuts = nodes.nuts
-local tonode = nuts.tonode
-local nodepool = nuts.pool
-local new_rule = nodepool.rule
-local new_glyph = nodepool.glyph
-local new_latelua = nodepool.latelua
-
-local setattrlist = nuts.setattrlist
-
-local texgetcount = tex.getcount
-local texsetcount = tex.setcount
+local current_font = font.current
+local texgetcount = tex.getcount
+local texsetcount = tex.setcount
-- a set of basic fast ones
-function context.setfontid(n)
- -- isn't there a setter?
- context("\\setfontid%i\\relax",n)
-end
-
function context.char(k) -- used as escape too, so don't change to utf
if type(k) == "table" then
local n = #k
@@ -81,35 +70,30 @@ function context.utfchar(k)
end
end
-function context.rule(w,h,d,direction)
+function context.rule(w,h,d,dir)
local rule
if type(w) == "table" then
- rule = new_rule(w.width,w.height,w.depth,w.direction)
+ rule = new_rule(w.width,w.height,w.depth,w.dir)
else
- rule = new_rule(w,h,d,direction)
+ rule = new_rule(w,h,d,dir)
end
- setattrlist(rule,true)
- context(tonode(rule))
- -- ctx_flushnode(tonode(rule))
+ rule.attr = current_attr()
+ context(rule)
end
function context.glyph(id,k)
if id then
if not k then
- id, k = true, id
+ id, k = current_font(), id
end
local glyph = new_glyph(id,k)
- setattrlist(glyph,true)
- context(tonode(glyph))
- -- ctx_flushnode(tonode(glyph))
+ glyph.attr = current_attr()
+ context(glyph)
end
end
--- local function ctx_par () context("\\par") end
--- local function ctx_space() context("\\space") end
-
-local ctx_par = context.cs.par
-local ctx_space = context.cs.space
+local function ctx_par () context("\\par") end
+local function ctx_space() context("\\space") end
context.par = ctx_par
context.space = ctx_space
@@ -117,11 +101,8 @@ context.space = ctx_space
ctxcore.par = ctx_par
ctxcore.space = ctx_space
--- local function ctx_bgroup() context("{") end
--- local function ctx_egroup() context("}") end
-
-local ctx_bgroup = context.cs.bgroup
-local ctx_egroup = context.cs.egroup
+local function ctx_bgroup() context("{") end
+local function ctx_egroup() context("}") end
context.bgroup = ctx_bgroup
context.egroup = ctx_egroup
@@ -155,21 +136,13 @@ function ctxcore.flushboxregister(n)
context(type(n) == "number" and [[\box%s ]] or [[\box\%s]],n)
end
--- function ctxcore.beginhbox() context([[\hbox\bgroup]]) end
--- function ctxcore.beginvbox() context([[\vbox\bgroup]]) end
--- function ctxcore.beginvtop() context([[\vtop\bgroup]]) end
-
-local ctx_hbox = context.cs.hbox
-local ctx_vbox = context.cs.vbox
-local ctx_vtop = context.cs.vtop
+function ctxcore.beginhbox() context([[\hbox{]]) end
+function ctxcore.beginvbox() context([[\vbox{]]) end
+function ctxcore.beginvtop() context([[\vtop{]]) end
-function ctxcore.beginhbox() ctx_hbox() ctx_bgroup() end
-function ctxcore.beginvbox() ctx_vbox() ctx_bgroup() end
-function ctxcore.beginvtop() ctx_vtop() ctx_bgroup() end
-
-ctxcore.endhbox = ctx_egroup -- \egroup
-ctxcore.endvbox = ctx_egroup -- \egroup
-ctxcore.endvtop = ctx_egroup -- \egroup
+ctxcore.endhbox = ctx_egroup
+ctxcore.endvbox = ctx_egroup
+ctxcore.endvtop = ctx_egroup
local function allocate(name,what,cmd)
local a = format("c_syst_last_allocated_%s",what)
@@ -192,65 +165,3 @@ context.registers = {
-- not really a register but kind of belongs here
newchar = function(name,u) context([[\chardef\%s=%s\relax]],name,u) end,
}
-
-do
-
- if CONTEXTLMTXMODE > 1 then
-
- function context.latelua(f)
- -- table check moved elsewhere
- local latelua = new_latelua(f)
- setattrlist(latelua,true) -- will become an option
- ctx_flushnode(latelua,true)
- end
-
- else
-
- function context.latelua(f)
- if type(f) == "table" then
- local action = f.action
- local specification = f.specification or f
- f = function() action(specification) end
- end
- local latelua = new_latelua(f)
- setattrlist(latelua,true) -- will become an option
- ctx_flushnode(latelua,true)
- end
-
- end
-
-end
--- yes or no
-
-do
-
- local NC = ctxcore.NC
- local BC = ctxcore.BC
- local NR = ctxcore.NR
-
- context.nc = setmetatable({ }, {
- __call =
- function(t,...)
- NC()
- return context(...)
- end,
- __index =
- function(t,k)
- NC()
- return context[k]
- end,
- }
- )
-
- function context.bc(...)
- BC()
- return context(...)
- end
-
- function context.nr(...)
- NC()
- NR()
- end
-
-end
-