summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/regstats
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-08-02 19:07:04 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-08-02 19:07:04 +0000
commit851cbda47f6d6b94ecea026f9e3845272185ce47 (patch)
tree748b83f98bff6e90cfc6a847f62146857de0a22c /Master/texmf-dist/tex/latex/regstats
parent80d2fb67910f81686ae45787106ec6d5a2797473 (diff)
regstats 2011/06/18, v1.0d
git-svn-id: svn://tug.org/texlive/trunk@23335 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/regstats')
-rw-r--r--Master/texmf-dist/tex/latex/regstats/regstats.sty150
1 files changed, 106 insertions, 44 deletions
diff --git a/Master/texmf-dist/tex/latex/regstats/regstats.sty b/Master/texmf-dist/tex/latex/regstats/regstats.sty
index 946a338bf9f..f175cdb2258 100644
--- a/Master/texmf-dist/tex/latex/regstats/regstats.sty
+++ b/Master/texmf-dist/tex/latex/regstats/regstats.sty
@@ -9,7 +9,7 @@
%% This is a generated file.
%%
%% Project: regstats
-%% Version: 2011/05/16 v1.0b
+%% Version: 2011/06/18 v1.0d
%%
%% Copyright (C) 2011 by
%% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
@@ -39,7 +39,7 @@
%% regstats-example.tex.
%%
\NeedsTeXFormat{LaTeX2e}[2009/09/24]
-\ProvidesPackage{regstats}[2011/05/16 v1.0b
+\ProvidesPackage{regstats}[2011/06/18 v1.0d
Counting used registers (HMM)]
%% Allows to count the number of used registers
@@ -57,30 +57,57 @@
\SetupKeyvalOptions{family=regstats,prefix=regstats@}
\DeclareBoolOption{proof}% \regstats@proof
+\DeclareBoolOption{left}
+\DeclareBoolOption{timer}
+
\ProcessKeyvalOptions*
-\newif\ifetex
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname eTeXversion\endcsname\relax
- \etexfalse
+\ifregstats@proof
+ \PackageInfo{regstats}{%
+ This package will use one of each kind of register itself!\MessageBreak%
+ (And other packages used by this package\MessageBreak%
+ probably use additional resources,\MessageBreak%
+ if those packages are not used anyway.)\MessageBreak%
+ }
\else
- \etextrue
+ \PackageInfo{regstats}{%
+ This package will use one counter itself!\MessageBreak%
+ (And other packages used by this package\MessageBreak%
+ probably use additional resources,\MessageBreak%
+ if those packages are not used anyway.)\MessageBreak%
+ }
\fi
-\ifetex
- \PackageInfo{regstats}{e-TeX found.}
-\else
- \PackageWarning{regstats}{Could not find e-TeX.\MessageBreak%
- That can mean that e-TeX was disabled or\MessageBreak%
- that your distribution of TeX does not contain e-TeX.\MessageBreak%
- Some packages will not work without e-TeX,\MessageBreak%
- but should give according messages.\MessageBreak%
- }
+\ifregstats@timer
+ \RequirePackage{intcalc}[2007/09/27]% v1.1
\fi
+\AtBeginDocument{%
+ \newif\ifetex
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname eTeXversion\endcsname\relax
+ \etexfalse
+ \else
+ \@ifpackageloaded{etex}{\etextrue}{\etexfalse}
+ \fi
+ \ifetex
+ \PackageInfo{regstats}{e-TeX found.}
+ \else
+ \PackageWarning{regstats}{Could not find e-TeX.\MessageBreak%
+ That can mean that e-TeX was disabled or\MessageBreak%
+ that your distribution of TeX does not contain e-TeX\MessageBreak%
+ or that you forgot to say \string\usepackage{etex}\MessageBreak%
+ in the preamble of \jobname.tex.\MessageBreak%
+ Some packages will not work without e-TeX,\MessageBreak%
+ but should give according messages.\MessageBreak%
+ }
+ \fi
+ }
+
\AtVeryEndDocument{%
\AtVeryVeryEnd{%
- \newcommand{\regstats@s}[3]{%
+ \def\regstats@lft{}%
+ \newcommand{\regstats@regstat}[5]{%
\setcounter{regstatscount}{#1}
\ifnum \value{regstatscount}=0
\setcounter{regstatscount}{2}
@@ -90,14 +117,28 @@
\else
\gdef\regstats@pl{#2}
\fi
- }
+ \ifetex\edef\regstats@max{#5}\else\edef\regstats@max{#4}\fi
+ \ifregstats@left
+ \setcounter{regstatscount}{\regstats@max}
+ \addtocounter{regstatscount}{-#1}
+ \ifnum \value{regstatscount}>0
+ \edef\regstats@lft{, left: \arabic{regstatscount}}
+ \else
+ \ifnum \value{regstatscount}=0
+ \edef\regstats@lft{, left: \arabic{regstatscount} !!!}
+ \else% \value{regstatscount}<0
+ \edef\regstats@lft{, left: \arabic{regstatscount} **********}
+ \fi
+ \fi
+ \fi
+ }
\newcounter{regstatscount}
\edef\regstats@counter{\the\allocationnumber}
\ifregstats@proof
\PackageWarning{regstats}{%
Package regstats loaded with option 'proof'.\MessageBreak%
- This package itself will use one of each register\MessageBreak%
- for testing!%
+ This package itself will now use\MessageBreak%
+ one of each register for testing!%
}%
\def\regstats@proof{1}
\edef\regstats@test{\the\count10}
@@ -178,9 +219,10 @@
\edef\regstats@test{0}
\ifx\regstats@proof\regstats@test
\message{Regstats test for register numbers failed.^^J}
- \message{Therefore option 'proof' is necessary to get the right numbers.^^J}
+ \message{Therefore option 'proof' is necessary to get the %
+ right numbers.^^J}
\fi
- \else
+ \else
\edef\regstats@dimen{\the\count11}
\edef\regstats@skip{\the\count12}
\edef\regstats@muskip{\the\count13}
@@ -199,28 +241,48 @@
\message{^^J}
\message{Here is how much of TeX's registers you used^^J}%
\message{\space (numbers of available registers are estimated!):^^J}%
- \regstats@s{\regstats@counter}{}{s}
- \message{ \regstats@counter\space counter register\regstats@pl\space out of}\ifetex\message{32767}\else\message{233}\fi
- \regstats@s{\regstats@dimen}{}{s}
- \message{^^J \regstats@dimen\space dimen register\regstats@pl\space out of}\ifetex\message{32767}\else\message{233}\fi
- \regstats@s{\regstats@skip}{}{s}
- \message{^^J \regstats@skip\space skip register\regstats@pl\space out of 233}
- \regstats@s{\regstats@muskip}{}{s}
- \message{^^J \regstats@muskip\space muskip register\regstats@pl\space out of}\ifetex\message{32767}\else\message{255}\fi
- \regstats@s{\regstats@box}{}{s}
- \message{^^J \regstats@box\space box register\regstats@pl\space out of}\ifetex\message{32767}\else\message{233}\fi
- \regstats@s{\regstats@toks}{}{s}
- \message{^^J \regstats@toks\space toks register\regstats@pl\space out of}\ifetex\message{32767}\else\message{255}\fi
- \regstats@s{\regstats@read}{}{s}
- \message{^^J \regstats@read\space input stream\regstats@pl\space (read) out of 15}
- \regstats@s{\regstats@write}{}{s}
- \message{^^J \regstats@write\space output stream\regstats@pl\space (write) out of 15}
- \regstats@s{\regstats@fam}{y}{ies}
- \message{^^J \regstats@fam\space math famil\regstats@pl\space (fam) out of 15}
- \regstats@s{\regstats@language}{}{s}
- \message{^^J \regstats@language\space language code\regstats@pl\space out of 255}
- \regstats@s{\regstats@insert}{}{s}
- \message{^^J \regstats@insert\space insertion\regstats@pl\space out of}\ifetex\message{124^^J}\else\message{101^^J}\fi
+ \regstats@regstat{\regstats@counter}{}{s}{233}{32767}
+ \message{ \regstats@counter\space counter register\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@dimen}{}{s}{233}{32767}
+ \message{ \regstats@dimen\space dimen register\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@skip}{}{s}{233}{32767}
+ \message{ \regstats@skip\space skip register\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@muskip}{}{s}{255}{32767}
+ \message{ \regstats@muskip\space muskip register\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@box}{}{s}{233}{32767}
+ \message{ \regstats@box\space box register\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@toks}{}{s}{255}{32767}
+ \message{ \regstats@toks\space toks register\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@read}{}{s}{15}{15}
+ \message{ \regstats@read\space input stream\regstats@pl\space (read) out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@write}{}{s}{15}{15}
+ \message{ \regstats@write\space output stream\regstats@pl\space (write) out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@fam}{y}{ies}{15}{15}
+ \message{ \regstats@fam\space math famil\regstats@pl\space (fam) out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@language}{}{s}{255}{255}
+ \message{ \regstats@language\space language code\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \regstats@regstat{\regstats@insert}{}{s}{101}{124}
+ \message{ \regstats@insert\space insertion\regstats@pl\space out of \regstats@max \regstats@lft ^^J}
+ \ifregstats@timer
+ \message{^^J}
+ \setcounter{regstatscount}{\the\pdfelapsedtime}
+ \edef\regstatselapsedtime{\arabic{regstatscount}}
+ \divide \value{regstatscount} by 65536% scaledseconds -> seconds
+ \edef\regstatsseconds{\arabic{regstatscount}}
+ \ifnum \value{regstatscount} > 59
+ \edef\regstatsseconds{\intcalcMod{\value{regstatscount}}{60}}
+ \divide \value{regstatscount} by 60% seconds -> minutes
+ \else
+ \setcounter{regstatscount}{0}% minutes = 0
+ \fi
+ \ifnum \regstatsseconds < 10
+ \message{Time elapsed: about \arabic{regstatscount}:0\regstatsseconds%
+ \space (m:ss; \regstatselapsedtime /65536 s).^^J}
+ \else
+ \message{Time elapsed: about \arabic{regstatscount}:\regstatsseconds %
+ \space (m:ss; \regstatselapsedtime /65536 s).^^J}
+ \fi
+ \fi
}
}