summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/localloc/localloc.sty
blob: bc3843400e73c0d930ae4d9980375b366cdb4ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
%%
%% This is file `localloc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% localloc.dtx  (with options: `package')
%% 
%% This is a file of the `localloc' package reimplementing
%% plain-TeX's and LaTeX's basic allocation macros to allow
%% local allocation of registers.
%% 
%% -- Copyright (C) 1991-1995 Bernd Raichle.  All rights reserved --
%% 
%% This package is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%% 
%% 
%% IMPORTANT NOTICE:
%% 
%% Copying of this file is authorized only if either
%% (1) you make absolutely no changes to your copy, including name, or
%% (2) if you do make changes, you name it something other than
%%     localloc.dtx, localloc.doc, localloc.tex, or localloc.sty.
%% 
%% For error reports see original source file `localloc.dtx'.
%% 
\expandafter\ifx\csname lnewcount\endcsname\relax
\else \expandafter\endinput \fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\else
  \NeedsTeXFormat{LaTeX2e}
  \ProvidesPackage{localloc}%
    [1995/09/24 v1.1b %
     Additional LaTeX Kernel Macros (local allocation)]
\fi
\expandafter\chardef\csname lcllc@at\endcsname=\catcode`\@
\catcode`\@=11 % \makeatletter
\def\lcllc@cnvmutocnt#1{\expandafter\lcllc@delmukey\the#1}
\begingroup \catcode`\M=12 \catcode`\U=12 \catcode`\.=12
  \lowercase{\endgroup
\def\lcllc@delmukey#1.#2MU{#1}}
\countdef\count@ptr    = 10
\countdef\dimen@ptr    = 11
\countdef\skip@ptr     = 12
\countdef\muskip@ptr   = 13
\countdef\box@ptr      = 14
\countdef\toks@ptr     = 15
\countdef\read@ptr     = 16
\countdef\write@ptr    = 17
\countdef\mathfam@ptr  = 18
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname newlanguage\endcsname\relax
  \csname newcount\endcsname\language@ptr
\else
  \countdef\language@ptr = 19
\fi
\newmuskip\count@limit  \count@limit  = \the\insc@unt mu
\newmuskip\dimen@limit  \dimen@limit  = \the\insc@unt mu
\newmuskip\skip@limit   \skip@limit   = \the\insc@unt mu
\newmuskip\box@limit    \box@limit    = \the\insc@unt mu
\newmuskip\muskip@limit \muskip@limit = 256mu
\newmuskip\toks@limit   \toks@limit   = 256mu
\newmuskip\cclvi@mu     \cclvi@mu     = 256mu
\newmuskip\xvi@mu       \xvi@mu       = 16mu
\def\newcount  {\alloc@\count@ptr  \count@limit \count  1\countdef }
\def\newdimen  {\alloc@\dimen@ptr  \dimen@limit \dimen  1\dimendef }
\def\newskip   {\alloc@\skip@ptr   \skip@limit  \skip   1\skipdef  }
\def\newmuskip {\alloc@\muskip@ptr \muskip@limit\muskip 0\muskipdef}
\def\newbox    {\alloc@\box@ptr    \box@limit   \box    1\chardef  }
\def\newtoks   {\alloc@\toks@ptr   \toks@limit  \toks   0\toksdef  }
\def\newread   {\alloc@\read@ptr   \xvi@mu      \read   0\chardef  }
\def\newwrite  {\alloc@\write@ptr  \xvi@mu      \write  0\chardef  }
\def\newfam    {\alloc@\mathfam@ptr\xvi@mu      \fam    0\chardef  }
\def\newlanguage{\alloc@\lang@ptr  \cclvi@mu   \language0\chardef  }
\def\lnewcount {\lalloc@\count@ptr \count@limit \count  1\countdef }
\def\lnewdimen {\lalloc@\dimen@ptr \dimen@limit \dimen  1\dimendef }
\def\lnewskip  {\lalloc@\skip@ptr  \skip@limit  \skip   1\skipdef  }
\def\lnewmuskip{\lalloc@\muskip@ptr\muskip@limit\muskip 0\muskipdef}
\def\lnewbox   {\lalloc@\box@ptr   \box@limit   \box    1\chardef  }
\def\lnewtoks  {\lalloc@\toks@ptr  \toks@limit  \toks   0\toksdef  }
\def\lcllc@insnums{}
\def\lcllc@checkins#1{%
  \begingroup
    \def\do##1.{%
      \ifnum##1=\allocationnumber
        \advance\allocationnumber#1\relax
        \noexpand\lcllc@checkins{#1}%
      \fi}%
    \edef\x{\endgroup \lcllc@insnums}%
  \x}
\def\alloc@#1#2#3#4{%
  \allocationnumber#1%
  \advance\allocationnumber\@ne
  \ifnum#4=\@ne \lcllc@checkins\@ne \fi
  \global#1\allocationnumber
  \ch@ck#1#2#3%
  \lcllc@def\global{}#3}
\def\lalloc@#1#2#3#4{%
  \allocationnumber\lcllc@cnvmutocnt#2%
  \advance\allocationnumber\m@ne
  \ifnum#4=\@ne \lcllc@checkins\m@ne \fi
  #2\the\allocationnumber mu %
  \ch@ck#1#2#3%
  \lcllc@def\relax{(local)}#3}
\def\ch@ck#1#2#3{%
  \ifnum#1<\lcllc@cnvmutocnt#2\relax \else
    \errmessage{No room for a new #3}%
    % \allocationnumber\m@ne
  \fi}
\def\lcllc@def#1#2#3#4#5{%
  #1#4#5=\allocationnumber
  \wlog{\string#5#2=\string#3\the\allocationnumber}}
\def\lcllc@getmax#1{%
  \ifnum#1<\allocationnumber \else
    \allocationnumber#1\advance\allocationnumber\@ne
  \fi}
\outer\def\newinsert{%
  \allocationnumber\m@ne
  \lcllc@getmax\count@ptr \lcllc@getmax\dimen@ptr
  \lcllc@getmax\skip@ptr  \lcllc@getmax\box@ptr
  \lcllc@checkins\@ne
  \ch@ck\allocationnumber\count@limit\count
  \ch@ck\allocationnumber\dimen@limit\dimen
  \ch@ck\allocationnumber\skip@limit\skip
  \ch@ck\allocationnumber\box@limit\box
  \begingroup
    \let\do\relax
    \xdef\lcllc@insnums{\do\the\allocationnumber.\lcllc@insnums}%
  \endgroup
  \lcllc@def\global{}\insert\chardef}
\catcode`\@=\lcllc@at
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\endinput
%%
%% End of file `localloc.sty'.