summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes3
-rw-r--r--TODO16
-rw-r--r--luatexbase-attr.dtx50
3 files changed, 37 insertions, 32 deletions
diff --git a/Changes b/Changes
index cd5cce7..e1be3a1 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
Changes in the luatexbase package/bundle
+[on-going]
+ luatexbase-attrs
+ - newly allocated attributes are now unset
2010/01/21
luatexbase-regs 0.1
diff --git a/TODO b/TODO
index 718448b..1c8d40e 100644
--- a/TODO
+++ b/TODO
@@ -1,25 +1,29 @@
general
-------
-- change lua module names
-- change TeX macros prefixes
+- change prefix for internal TeX macros
- check for lua name conflicts ('module' used in mods)
- check for macros starting with \luatex
- write test files
- reload check, declaration, luatex test
+- handle catcodes for Plain (more comprensive defenses to be added later)
- import/update doc
-- fix Makefile: test files are source, not runfiles
-- make tests cleaner: \begingroup\expandafter\ETC.
-- handle catcodes for Plain
-- import/write doc
+- make TeX tests cleaner: \begingroup\expandafter\ETC.
Later
=====
+- change lua module name(s) (luatexbase or luatexbase.regs etc)
+
regs
----
- Should the various allocation macros set something in a Lua table, or should
we just wait for it to be implemented in LuaTeX? (The \*blk macros would be
rather tricky in this respect, but are they really used?)
+
+attr
+---
+
+- don't write in the tex table!
diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx
index fe68a3b..8f68efc 100644
--- a/luatexbase-attr.dtx
+++ b/luatexbase-attr.dtx
@@ -144,23 +144,22 @@ and the derived files
% the other |\new*| macros, to $65536$ attributes can be allocated.
%
% \begin{macrocode}
-\newcount\luatexattdefcounter
-\luatexattdefcounter = 1
+\newcount\lltxb@attribute@alloc
+\lltxb@attribute@alloc\m@ne
\def\newluatexattribute#1{%
- \ifnum\luatexattdefcounter<65535\relax %
- \global\advance\luatexattdefcounter by 1\relax %
- \allocationnumber\luatexattdefcounter %
- \ifluatex %
- \global\luatexattributedef#1=\allocationnumber %
- \fi %
+ \ifnum\lltxb@attribute@alloc<65535\relax
+ \global\advance\lltxb@attribute@alloc\@ne
+ \allocationnumber\lltxb@attribute@alloc
+ \ifluatex
+ \global\luatexattributedef#1=\allocationnumber
+ \fi
\wlog{\string#1=\string\luatexattribute\the\allocationnumber}%
- \luadirect{%
- luatextra.attributedef_from_tex([[\noexpand#1]],
- '\number\allocationnumber')}%
- \else %
+ \begingroup\escapechar\m@ne \expandafter\endgroup
+ \directlua{luatextra.attributedef_from_tex(
+ '\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
+ \else
\errmessage{No room for a new \string\attribute}%
- \fi %
-}
+ \fi}
% \end{macrocode}
%
% Two convenient macros, one to set an attribute (basically just a
@@ -170,15 +169,14 @@ and the derived files
%
% \begin{macrocode}
\def\setluatexattribute#1#2{%
- #1=\numexpr#2\relax %
+ #1=\numexpr#2\relax
}
\def\unsetluatexattribute#1{%
- \ifnum\luatexversion<37\relax %
- #1=-1\relax %
- \else %
- #1=-"7FFFFFFF\relax %
- \fi %
-}
+ \ifnum\luatexversion<37\relax
+ #1=-1\relax
+ \else
+ #1=-"7FFFFFFF\relax
+ \fi}
% \end{macrocode}
%
% \begin{macrocode}
@@ -208,11 +206,11 @@ and the derived files
% can simply call |tex.attributenumber[myattribute]|.
%
% \begin{macrocode}
-luatextra.attributes = {}
-tex.attributenumber = luatextra.attributes
-function luatextra.attributedef_from_tex(name, number)
- truename = name:gsub('[\\ ]', '')
- luatextra.attributes[truename] = tonumber(number)
+module('luatextra', package.seeall)
+attributes = {}
+tex.attributenumber = attributes
+function attributedef_from_tex(name, number)
+ attributes[name] = tonumber(number)
end
% \end{macrocode}
%