| 1 |
%% |
| 2 |
%% This is file `regstats-example.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% regstats.dtx (with options: `example') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Project: regstats |
| 12 |
%% Version: 2025-01-28 v1.1b |
| 13 |
%% Info: Counting used registers |
| 14 |
%% |
| 15 |
%% Copyright (C) 2011 - 2025 by |
| 16 |
%% H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de> |
| 17 |
%% |
| 18 |
%% This work may be distributed and/or modified under the |
| 19 |
%% conditions of the LaTeX Project Public License, either |
| 20 |
%% version 1.3c of this license or (at your option) any later |
| 21 |
%% version. This version of this license is in |
| 22 |
%% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 23 |
%% and the latest version of this license is in |
| 24 |
%% https://www.latex-project.org/lppl.txt |
| 25 |
%% and version 1.3c or later is part of all distributions of |
| 26 |
%% LaTeX version 2005-12-01 or later. |
| 27 |
%% |
| 28 |
%% This work has the LPPL maintenance status "maintained". |
| 29 |
%% |
| 30 |
%% The Current Maintainer of this work is H.-Martin Muench. |
| 31 |
%% |
| 32 |
%% This work consists of the main source file regstats.dtx, |
| 33 |
%% the README, and the derived files |
| 34 |
%% regstats.sty, regstats.pdf, |
| 35 |
%% regstats.ins, regstats.drv, |
| 36 |
%% regstats-example.tex, regstats-example.pdf, |
| 37 |
%% regstats-example.log. |
| 38 |
%% |
| 39 |
%% In memoriam |
| 40 |
%% Claudia Simone Barth + 1996-01-30 |
| 41 |
%% Tommy Muench + 2014-01-02 |
| 42 |
%% Hans-Klaus Muench + 2014-08-24 |
| 43 |
%% |
| 44 |
%% When compiling with LuaLaTeX (and wanting to use option timer=true), |
| 45 |
%% the following line must be uncommented (i.e. remove the "%% "). |
| 46 |
%% \directlua{starttime = os.clock()} |
| 47 |
\documentclass[british]{article} |
| 48 |
\usepackage[left=true,timer=true]{regstats}[2025/01/28]% v1.1b Counting used registers (HMM) |
| 49 |
\ifpdf\ifluatex\else |
| 50 |
\pdfinfo{ |
| 51 |
/Author (H.-Martin Muench) |
| 52 |
/Title (regstats package example) |
| 53 |
/Subject (Example for the regstats package) |
| 54 |
/Keywords (LaTeX;registers;read;write;language;box;dimen;count;toks;muskip;skip;counter;regstats) |
| 55 |
} |
| 56 |
\fi\fi |
| 57 |
%% If you use the hyperref package, use the options of that package |
| 58 |
%% to set the pdf information. |
| 59 |
%% Do NOT use \pdfinfo AND the hyperref package! |
| 60 |
|
| 61 |
%%\usepackage{etex} |
| 62 |
%%\usepackage{morewrites} |
| 63 |
|
| 64 |
\makeatletter |
| 65 |
\newcommand{\stressCounter}[1]{% |
| 66 |
\ifnum\the\count10<#1\relax\else\message{Already \the\count10 \space counters used.} \fi% |
| 67 |
\@tempcnta=0\relax% |
| 68 |
\@whilenum\the\count10<#1\do% |
| 69 |
{\advance\@tempcnta +1\relax% |
| 70 |
\newcounter{TestCounter\the\@tempcnta} \message{counter \the\allocationnumber ^^J}% |
| 71 |
}% |
| 72 |
} |
| 73 |
|
| 74 |
\newcommand{\stressDimen}[1]{% |
| 75 |
\ifnum\the\count11<#1\relax\else\message{Already \the\count11 \space dimens used.} \fi% |
| 76 |
\@tempcnta=0\relax% |
| 77 |
\@whilenum\the\count11<#1\do% |
| 78 |
{\advance\@tempcnta +1\relax% |
| 79 |
\expandafter\newdimen\csname TestDimen\the\@tempcnta\endcsname \message{dimen \the\allocationnumber ^^J}% |
| 80 |
}% |
| 81 |
} |
| 82 |
|
| 83 |
\newcommand{\stressSkip}[1]{\% |
| 84 |
\ifnum\the\count12<#1\relax\else\message{Already \the\count11 \space skips used.} \fi% |
| 85 |
\@tempcnta=0\relax% |
| 86 |
\@whilenum\the\count12<#1\do% |
| 87 |
{\advance\@tempcnta +1\relax% |
| 88 |
\expandafter\newskip\csname TestSkip\the\@tempcnta\endcsname \message{skip \the\allocationnumber ^^J}% |
| 89 |
}% |
| 90 |
} |
| 91 |
|
| 92 |
\newcommand{\stressMuskip}[1]{% |
| 93 |
\ifnum\the\count13<#1\relax\else\message{Already \the\count11 \space muskips used.} \fi% |
| 94 |
\@tempcnta=0\relax% |
| 95 |
\@whilenum\the\count13<#1\do% |
| 96 |
{\advance\@tempcnta +1\relax% |
| 97 |
\expandafter\newmuskip\csname TestMuskip\the\@tempcnta\endcsname \message{muskip \the\allocationnumber ^^J}% |
| 98 |
}% |
| 99 |
} |
| 100 |
|
| 101 |
\newcommand{\stressBox}[1]{% |
| 102 |
\ifnum\the\count14<#1\relax\else\message{Already \the\count11 \space boxes used.} \fi% |
| 103 |
\@tempcnta=0\relax% |
| 104 |
\@whilenum\the\count14<#1\do% |
| 105 |
{\advance\@tempcnta +1\relax% |
| 106 |
\expandafter\newbox\csname TestBox\the\@tempcnta\endcsname \message{box \the\allocationnumber ^^J}% |
| 107 |
}% |
| 108 |
} |
| 109 |
|
| 110 |
\newcommand{\stressToks}[1]{% |
| 111 |
\ifnum\the\count15<#1\relax\else\message{Already \the\count11 \space toks used.} \fi% |
| 112 |
\@tempcnta=0\relax% |
| 113 |
\@whilenum\the\count15<#1\do% |
| 114 |
{\advance\@tempcnta +1\relax% |
| 115 |
\expandafter\newtoks\csname TestToks\the\@tempcnta\endcsname \message{toks \the\allocationnumber ^^J}% |
| 116 |
}% |
| 117 |
} |
| 118 |
|
| 119 |
\newcommand{\stressRead}[1]{% |
| 120 |
\ifnum\the\count16<#1\relax\else\message{Already \the\count11 \space reads used.} \fi% |
| 121 |
\@tempcnta=0\relax% |
| 122 |
\@whilenum\the\count16<#1\do% |
| 123 |
{\advance\@tempcnta +1\relax% |
| 124 |
\expandafter\newread\csname TestRead\the\@tempcnta\endcsname \message{read \the\allocationnumber ^^J}% |
| 125 |
}% |
| 126 |
} |
| 127 |
|
| 128 |
\newcommand{\stressWrite}[1]{% |
| 129 |
\ifnum\the\count17<#1\relax\else\message{Already \the\count11 \space writes used.} \fi% |
| 130 |
\@tempcnta=0\relax% |
| 131 |
\@whilenum\the\count17<#1\do% |
| 132 |
{\advance\@tempcnta +1\relax% |
| 133 |
\expandafter\newwrite\csname TestWrite\the\@tempcnta\endcsname \message{write \the\allocationnumber ^^J}% |
| 134 |
}% |
| 135 |
} |
| 136 |
|
| 137 |
\newcommand{\stressFam}[1]{% |
| 138 |
\ifnum\the\count18<#1\relax\else\message{Already \the\count11 \space fams used.} \fi% |
| 139 |
\@tempcnta=0\relax% |
| 140 |
\@whilenum\the\count18<#1\do% |
| 141 |
{\advance\@tempcnta +1\relax% |
| 142 |
\expandafter\newfam\csname TestFam\the\@tempcnta\endcsname \message{fam \the\allocationnumber ^^J}% |
| 143 |
}% |
| 144 |
} |
| 145 |
|
| 146 |
\newcommand{\stressLanguage}[1]{% |
| 147 |
\ifnum\the\count19<#1\relax\else\message{Already \the\count11 \space languages used.} \fi% |
| 148 |
\@tempcnta=0\relax% |
| 149 |
\@whilenum\the\count19<#1\do% |
| 150 |
{\advance\@tempcnta +1\relax% |
| 151 |
\expandafter\newlanguage\csname TestLanguage\the\@tempcnta\endcsname \message{language \the\allocationnumber ^^J}% |
| 152 |
}% |
| 153 |
} |
| 154 |
|
| 155 |
\newcommand{\stressInsert}[1]{% |
| 156 |
\message{Declaring #1\space ADDITIONAL inserts:}% |
| 157 |
\@tempcnta=0\relax% |
| 158 |
\@whilenum\the\@tempcnta<#1\do% |
| 159 |
{\advance\@tempcnta +1\relax% |
| 160 |
\expandafter\newinsert\csname TestInsert\the\@tempcnta\endcsname% |
| 161 |
\message{insert \the\@tempcnta: \the\allocationnumber^^J}% |
| 162 |
}% |
| 163 |
} |
| 164 |
\makeatother |
| 165 |
|
| 166 |
\listfiles |
| 167 |
\begin{document} |
| 168 |
\pagenumbering{arabic} |
| 169 |
\section*{Example for regstats} |
| 170 |
|
| 171 |
This example demonstrates the use of package\newline |
| 172 |
\textsf{regstats}, v1.1b as of 2025-01-28.\newline |
| 173 |
The used options were \texttt{left=true,timer=true}.\par |
| 174 |
\texttt{left=false,timer=false} would be the defaults.\newline |
| 175 |
|
| 176 |
Regarding the use of |
| 177 |
\makeatletter% |
| 178 |
\ \@ifundefined{eTeX}{\hbox{$\m@th \varepsilon $-\TeX}}{\eTeX}, % |
| 179 |
\makeatother% |
| 180 |
the \texttt{morewrite} package, the reservation of \texttt{insert}s, |
| 181 |
and using more \texttt{math families} please see the documentation!\newline |
| 182 |
|
| 183 |
For the resulting message, please compile \texttt{regstats-example.tex} |
| 184 |
and have a look at the end of its \texttt{.log}-file.\newline |
| 185 |
|
| 186 |
Because the compilation time for this example is usually quite short, |
| 187 |
option \texttt{timer} is not demonstrated very spectacular.\newline |
| 188 |
|
| 189 |
To test a register type for the number of available registers, |
| 190 |
uncomment the respective line below and set the number to an interesting value. |
| 191 |
|
| 192 |
\makeatletter |
| 193 |
%%\stressCounter{233} |
| 194 |
%%\stressDimen{233} |
| 195 |
%%\stressSkip{233} |
| 196 |
%%\stressMuskip{255} |
| 197 |
%%\stressBox{233} |
| 198 |
%%\stressToks{255} |
| 199 |
%%\stressRead{15} |
| 200 |
%%\stressWrite{14} |
| 201 |
%%\stressFam{15} |
| 202 |
%%\stressLanguage{255} |
| 203 |
%%\stressInsert{20} |
| 204 |
\makeatother |
| 205 |
|
| 206 |
\end{document} |
| 207 |
\endinput |
| 208 |
%% |
| 209 |
%% End of file `regstats-example.tex'. |