summaryrefslogtreecommitdiff
path: root/tex/context/base/cldf-bas.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-08-25 12:53:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-08-25 12:53:00 +0200
commite83414526611fee99bb66f0282fb1334c947cdab (patch)
tree13280ba974e4f9080ff7bc653857083d5818dcbc /tex/context/base/cldf-bas.lua
parentbc1e8c26c1c0596eb7410b522bff296fa6e7e2fc (diff)
downloadcontext-e83414526611fee99bb66f0282fb1334c947cdab.tar.gz
beta 2012.08.25 12:53
Diffstat (limited to 'tex/context/base/cldf-bas.lua')
-rw-r--r--tex/context/base/cldf-bas.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/tex/context/base/cldf-bas.lua b/tex/context/base/cldf-bas.lua
index dd6c575bf..9cf8dcd4a 100644
--- a/tex/context/base/cldf-bas.lua
+++ b/tex/context/base/cldf-bas.lua
@@ -34,6 +34,7 @@ local generics = context.generics
local variables = interfaces.variables
local new_rule = nodes.pool.rule
+local texcount = tex.count
function context.char(k) -- used as escape too, so don't change to utf
if type(k) == "table" then
@@ -142,3 +143,20 @@ end
context.endvbox = context.egroup
context.endhbox = context.egroup
+
+local function allocate(name,what,cmd)
+ local a = format("c_syst_last_allocated_%s",what)
+ local n = texcount[a] + 1
+ if n <= texcount.c_syst_max_allocated_register then
+ texcount[a] = n
+ end
+ context("\\global\\expandafter\\%sdef\\csname %s\\endcsname %s\\relax",cmd or what,name,n)
+ return n
+end
+
+function context.newdimen (name) return allocate(name,"dimen") end
+function context.newskip (name) return allocate(name,"skip") end
+function context.newcount (name) return allocate(name,"count") end
+function context.newmuskip(name) return allocate(name,"muskip") end
+function context.newtoks (name) return allocate(name,"toks") end
+function context.newbox (name) return allocate(name,"box","mathchar") end