Skip to content

Commit

Permalink
Use new \lx@alloc@ for plain's \alloc@, latex's \e@alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
brucemiller committed Dec 28, 2024
1 parent ddb4571 commit 6510161
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 5 additions & 0 deletions lib/LaTeXML/Engine/LaTeX.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Let('\magnification', '\@undefined');
Let('\@empty', '\lx@empty');
Let('\@ifundefined', '\lx@ifundefined');

# Use Package's register allocation to avoid allocating same slot twice; and ALWAYS have room!
DefMacro('\e@alloc{}{}{}{}{}{}', '\lx@alloc@{#1}{#3}{#2}{#6}', locked => 1);
DefMacro('\e@ch@ck{}{}{}{}', '', locked => 1);

#**********************************************************************
# Basic \documentclass & \documentstyle

Expand Down Expand Up @@ -771,6 +775,7 @@ sub beginAppendices {
else {
NewCounter($counter, 'document', idprefix => 'A');
DefMacroI('\the' . $counter, undef, '\Alph{' . $counter . '}', scope => 'global'); }
SetCounter($counter => Number(0)); # In case register was already defined
AssignMapping('counter_for_type', appendix => $counter);
Let(T_CS('\\' . $counter), T_CS('\@@appendix'), 'global');
Let(T_CS('\@appendix'), T_CS('\relax'), 'global');
Expand Down
13 changes: 4 additions & 9 deletions lib/LaTeXML/Engine/plain.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ DefPrimitive('\wlog{}', sub {
NoteLog(ToString(Expand($_[1])));
return; },
locked => 1);

# Use Package's register allocation to avoid allocating same slot twice; and ALWAYS have room!
DefMacro('\alloc@{}{}{}{}{}', '\lx@alloc@{#2}{\count1#1}{#3}{#5}', locked => 1);
DefMacro('\ch@ck{}{}{}', '', locked => 1);
# From plain.tex
RawTeX(<<'EoTeX');
\outer\def\newcount{\alloc@0\count\countdef\insc@unt}
Expand All @@ -211,18 +215,9 @@ RawTeX(<<'EoTeX');
\outer\def\newfam{\alloc@8\fam\chardef\sixt@@n}
\outer\def\newlanguage{\alloc@9\language\chardef\@cclvi}
EoTeX
DefMacro('\e@alloc{}{}{}{}{}{}',
'\global\advance#3\@ne
% \e@ch@ck{#3}{#4}{#5}#1%
\allocationnumber#3\relax
\global#2#6\allocationnumber
% \wlog{\string#6=\string#1\the\allocationnumber}
');
DefMacro('\alloc@{}{}{}{}', '\e@alloc#2#3{\count1#1}#4\float@count');

# This implementation is quite wrong
DefPrimitive('\newinsert Token', sub { DefRegisterI($_[1], undef, Number(0)); });
# \alloc@, \ch@ck

# TeX plain uses \newdimen, etc. for these.
# Is there any advantage to that?
Expand Down

0 comments on commit 6510161

Please sign in to comment.