summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:05:19 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:05:19 +0000
commitee0212e120bb432a474a7d5f7de31641543bccf6 (patch)
tree2ce2b4614fb65569245f708d4bee7bfdfd2c2116 /Master/texmf-dist
parentd04d8cfd20c2f7cc9d6c44a5e28d7e8f4e56796b (diff)
register
git-svn-id: svn://tug.org/texlive/trunk@1274 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/tex/latex/register/register.sty344
1 files changed, 344 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/register/register.sty b/Master/texmf-dist/tex/latex/register/register.sty
new file mode 100644
index 00000000000..24839e7d701
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/register/register.sty
@@ -0,0 +1,344 @@
+%%
+%% This is file `register.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% register.dtx (with options: `package')
+%% Register diagrams with field descriptions.
+%%
+%% This program is provided under the terms of the
+%% LaTeX Project Public License distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt.
+%%
+%% Author: Matthew Lovell (lovell@fc.hp.com)
+%%
+
+
+
+\ProvidesPackage{register} [2004/08/16 v1.4 Register macros with
+hyperref/LyX support]
+
+\RequirePackage{ifthen}[1997/11/02]
+\RequirePackage{graphicx}[1997/06/09]
+\RequirePackage{float}[2001/07/25]
+\RequirePackage{calc}[1998/06/07]
+\DeclareOption{LyX}{\setboolean{RegisterLyX}{true}}
+\DeclareOption{hyperref}{\setboolean{RegisterHyperref}{true}}
+\DeclareOption{TRflags}{\setboolean{RegisterTRFlags}{true}}
+\DeclareOption{TRboxed}{\setboolean{RegisterTRBoxed}{true}}
+
+\DeclareOption*{% Emit a warning for other options
+ \PackageWarning{register}{Unknown option '\CurrentOption'}%
+}
+
+\newboolean{RegisterLyX}
+\newboolean{RegisterHyperref}
+\newboolean{RegisterTRFlags}
+\newboolean{RegisterTRBoxed}
+
+\setboolean{RegisterLyX}{false}
+\setboolean{RegisterHyperref}{false}
+\setboolean{RegisterTRFlags}{false}
+\setboolean{RegisterTRBoxed}{false}
+
+\ProcessOptions\relax % Process package options
+\newboolean{RegisterContext}
+\setboolean{RegisterContext}{false}
+\floatstyle{plaintop} \@ifundefined{chapter}
+{\newfloat{Regfloat}{tbp}{rdf}[section]}
+{\newfloat{Regfloat}{tbp}{rdf}[chapter]}
+\floatname{Regfloat}{Register}
+\newlength{\regWidth}
+\newlength{\regFieldLen}
+\newlength{\regLabelAdjust}
+\newlength{\regResetHeight}
+\newlength{\regResetDepth}
+\newlength{\regResetDrop}
+\newlength{\regDescSkip}
+\setlength{\regWidth}{0.95\textwidth}
+\newcommand{\regBitWidth}{32}
+\newcommand{\regResetName}{Reset}
+\newcommand{\regBitSize}{\tiny}
+\newcommand{\regBitFamily}{\sffamily}
+\newcommand{\regResetSize}{\scriptsize}
+\newcommand{\regLabelSize}{\footnotesize}
+\newcommand{\regLabelFamily}{\rmfamily}
+\newcommand{\regDescFamily}{\bf}
+\newlength{\regdescsep}
+\newlength{\oldregdescsep}
+\setlength{\regdescsep}{-\medskipamount}
+
+\newsavebox{\Label}
+\newsavebox{\RotatedLabel}
+\newcounter{upperbit}
+\newcounter{lowerbit}
+\newenvironment{reglist}[1][M]
+ {\begin{list}{}
+ {\settowidth{\labelwidth}{\regDescFamily #1}
+ \addtolength{\labelwidth}{\labelsep}
+ \setlength{\leftmargin}{\labelwidth}
+ \addtolength{\leftmargin}{\labelsep}
+ \addtolength{\leftmargin}{0.5\regDescSkip}
+ \addtolength{\rightmargin}{0.5\regDescSkip}
+ \setlength{\topsep}{0pt}
+ \setlength{\itemsep}{0pt}
+ \setlength{\parsep}{0.5\baselineskip}
+ \renewcommand{\makelabel}[1]{\regDescFamily ##1 \hfill}}}
+ {\end{list}}
+\newenvironment{regdesc}[1][0.90\textwidth]%
+{%
+ \setlength{\regDescSkip}{\textwidth - #1}%
+ \vspace{\regdescsep}%
+\ifthenelse{\boolean{RegisterLyX}}{%
+ \renewenvironment{lyxlist}[1]
+ {\begin{list}{}
+ {\settowidth{\labelwidth}{\regDescFamily ##1}
+ \addtolength{\labelwidth}{\labelsep}
+ \setlength{\leftmargin}{\labelwidth}
+ \addtolength{\leftmargin}{\labelsep}
+ \addtolength{\leftmargin}{0.5\regDescSkip}
+ \addtolength{\rightmargin}{0.5\regDescSkip}
+ \setlength{\topsep}{0pt}
+ %\setlength{\partopsep}{0pt}
+ \renewcommand{\makelabel}[1]{\regDescFamily ####1 \hfill}}}
+ {\end{list}}}{}%
+ % endif
+ % set spacing appropriately
+ \leftskip 0.5\regDescSkip%
+ \rightskip 0.5\regDescSkip%
+ \parfillskip=\z@ plus 1fil%
+ \parskip=0.5\baselineskip \advance\parskip by 0pt plus 2pt%
+}% end begin{regdesc}
+{\vskip\baselineskip}
+\newcommand{\regnewline}{\\*}
+\newenvironment{register}[3]
+{\begin{Regfloat}[#1]%
+ \setlength{\leftskip}{0pt}%
+ \setlength{\oldregdescsep}{\regdescsep}%
+ \setlength{\regdescsep}{0.5\baselineskip}%
+ \setlength{\partopsep}{0pt}%
+ \setlength{\topsep}{0pt}%
+ \setboolean{RegisterContext}{true}%
+ \ifthenelse{\equal{#3}{}}%
+ {\caption[#2]{\textsc{#2}}}% else
+ {\caption[#2]{\textsc{#2} ({#3})}}%
+ \centering}
+{% restore lengths
+ \leftskip\z@%
+ \rightskip\z@%
+ \parfillskip=\z@ plus 1fil%
+ \setlength{\regdescsep}{\oldregdescsep}%
+ \setboolean{RegisterContext}{false}%
+ \end{Regfloat}}
+\def\spread#1{{\count0=0 \spreadaux#1\end}}
+\def\spreadaux#1{%
+ \ifx#1\end \let\next=\relax%
+ \else\ifx#1_\let\next=\spreadaux%
+ \else\advance\count0 by 1 \ifnum\count0>1{}\hfill\fi #1 %
+ \let\next=\spreadaux\fi\fi\next}
+\newcommand{\setRegLengths}{%
+ % Compute basic width of a single bit
+ \settowidth{\regFieldLen}{\regLabelSize \regResetName}%
+ \setlength{\regFieldLen}{\regWidth - \regFieldLen}%
+ \setlength{\regFieldLen}{\regFieldLen / \regBitWidth}%
+ % Figure out height and depth of reset field in current font
+ % Is there a more ``official'' method to do this?
+ \settodepth{\regResetDepth}{\regResetSize ()jgpq}%
+ \settoheight{\regResetHeight}{\regResetSize ()ABCjkl}%
+ \addtolength{\regResetHeight}{\regResetDepth}%
+ % Compute how far to drop the reset fields down. The value at
+ % the end is effectively the separation between the bit position
+ % box and the reset value box.
+ \setlength{\regResetDrop}{\regResetHeight + 2\fboxsep - 2\fboxrule + 3pt}%
+}
+\newcommand{\regMakeFieldName}[1]{%
+ % Create box to hold label
+ \savebox{\Label}{\regLabelSize\regLabelFamily #1}%
+}
+\newcommand{\regRotateFieldName}{%
+ \savebox{\RotatedLabel}{\rotatebox[origin=lB]{45}{\usebox{\Label}}}%
+ \makebox[0pt][l]{\raisebox{\regResetHeight + \fboxsep + \depth + 1pt}%
+ {\hspace{\regLabelAdjust}\usebox{\RotatedLabel}}}%
+}
+\newcommand{\typesetRegBits}[1]{%
+ \ifthenelse{#1 > 1}%
+ {\framebox[\regFieldLen][c]%
+ {\regBitSize \rule[-1\regResetDepth]{0pt}{\regResetHeight}%
+ \regBitFamily\arabic{upperbit} \hfill \arabic{lowerbit}}}%
+ {\framebox[\regFieldLen][c]%
+ {\regBitSize \rule[-1\regResetDepth]{0pt}{\regResetHeight}%
+ \regBitFamily\arabic{lowerbit}}}%
+}
+\newcommand{\typesetRegReset}[1]{%
+ % Typeset reset value in a framebox
+ \makebox[0pt][l]{\raisebox{-1\regResetDrop}{\framebox[\regFieldLen][c]%
+ % Place an invisible rule to control the box
+ % surrounding the reset field
+ {\regResetSize \rule[-1\regResetDepth]{0pt}{\regResetHeight} \spread{#1}}}}%
+}
+\newcommand{\regfield}[4]{%
+ % Compute overall field length
+ \setRegLengths%
+ \setlength{\regFieldLen}{#2\regFieldLen + \fboxrule}%
+ % Figure out bit positions
+ \setcounter{lowerbit}{#3}%
+ \setcounter{upperbit}{#3 + #2 - 1}%
+ \regMakeFieldName{#1}%
+ % Figure out how far over to place label, accounting for height
+ \setlength{\regLabelAdjust}{0.5\regFieldLen - 0.707107\ht\Label}%
+ % Now, rotate and type the label
+ \regRotateFieldName%
+ \typesetRegReset{#4}%
+ % Typeset bit positions in a framebox
+ \typesetRegBits{#2}%
+ \hspace{-1\fboxrule}%
+}
+\newcommand{\regfieldb}[3]{%
+ % Compute overall field length
+ \setRegLengths%
+ \setlength{\regFieldLen}{#2\regFieldLen + \fboxrule}%
+ % Figure out bit positions
+ \setcounter{lowerbit}{#3}%
+ \setcounter{upperbit}{#3 + #2 - 1}%
+ % Create box to hold label
+ \regMakeFieldName{#1}%
+ % Figure out how far over to place label, accounting for height
+ \setlength{\regLabelAdjust}{0.5\regFieldLen - 0.707107\ht\Label}%
+ % Now, rotate and typeset the label
+ \regRotateFieldName%
+ % Typeset bit positions
+ \typesetRegBits{#2}%
+ \hspace{-1\fboxrule}%
+}
+\newcommand{\regbits}[3]{%
+ % Compute overall field length
+ \setRegLengths%
+ \setlength{\regFieldLen}{#2\regFieldLen + \fboxrule}%
+ % Figure out bit positions
+ \setcounter{lowerbit}{#3}%
+ \setcounter{upperbit}{#3 + #2 - 1}%
+ % Create box to hold label
+ \regMakeFieldName{#1}%
+ % Figure out how far over to place label, accounting for height
+ \setlength{\regLabelAdjust}{0.5\regFieldLen - 0.707107\ht\Label}%
+ % Now, rotate and typeset the label
+ \regRotateFieldName%
+ % Typeset field value
+ \framebox[\regFieldLen][c]%
+ {\tiny \spread{#3}}%
+ \hspace{-1\fboxrule}%
+}
+\newcommand{\regspace}[1]{%
+ % Compute overall field length
+ \setRegLengths%
+ \setlength{\regFieldLen}{#1\regFieldLen + \fboxrule}%
+ \makebox[\regFieldLen]{}%
+}
+
+\newcommand{\reglabel}[1]{%
+ \settowidth{\regFieldLen}{\regLabelSize \regResetName}%
+ \setlength{\regResetDrop}{\regResetDrop + 0.5\fboxsep}%
+ $\,$\raisebox{-1\regResetDrop}{\makebox[\regFieldLen][l]%
+ {\regLabelSize\regBitFamily #1}}%
+}
+
+\newcommand{\reglabelb}[1]{%
+ \settowidth{\regFieldLen}{\regLabelSize \regResetName}%
+ $\,$\raisebox{-0.5\fboxsep}{\makebox[\regFieldLen][l]%
+ {\regLabelSize\regBitFamily #1}}%
+}
+\ifthenelse{\boolean{RegisterHyperref}}{%
+ % Define a counter for the hyperref package. Otherwise,
+ % the hyperlinks to registers don't work correctly
+ \@namedef{theHRegfloat}{\theRegfloat}
+
+ % Define a bookmark level for Regfloats (for hyperref package)
+ \def\toclevel@Regfloat{0}
+}{}
+\newcommand{\listofregisters}{%
+ \@ifundefined{ext@Regfloat}{\float@error{Regfloat}}{%
+ \@ifundefined{chapter}{\def\@tempa{\section*}}%
+ {\def\@tempa{\chapter*}}%
+ \@tempa{List of Registers\@mkboth{\uppercase{List of Registers}}%
+ {\uppercase{List of Registers}}}%
+ \addcontentsline{toc}{chapter}{List of Registers}%
+ \@starttoc{\@nameuse{ext@Regfloat}}}}
+\newcommand\l@Regfloat{\@dottedtocline{1}{1.5em}{2.3em}}
+\@ifundefined{chapter}{}
+{% Adjust chapter definition slightly for Regfloats
+\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}#1}%
+ \else
+ \addcontentsline{toc}{chapter}{#1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{#1}%
+ \fi
+ \chaptermark{#1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \addtocontents{rdf}{\protect\addvspace{10\p@}}% --- Add space ---
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{#2}]%
+ \else
+ \@makechapterhead{#2}%
+ \@afterheading
+ \fi}
+}
+\newcommand\@GetTRSecondParam{}
+\long\def\@GetTRSecondParam#1#2#3\@nil{#2}
+\newcommand*{\GetTRPageRef}[1]{%
+ \expandafter\expandafter\expandafter\@GetTRSecondParam
+ \csname r@#1\endcsname
+ 0% dummy, if the reference is undefined
+ \@nil
+}
+
+\newcommand{\TRfamily}{\sffamily}
+\newcounter{T@peReleaseTag}
+\newlength{\TRwidth}
+\setlength{\TRwidth}{\marginparwidth}
+\newlength{\T@peReleaseDepth}
+
+\newcommand{\TRwriteout}[1]{%
+ \makebox[\TRwidth][c]{%
+ \raisebox{\T@peReleaseDepth}{%
+ \ifthenelse{\boolean{RegisterTRBoxed}}%
+ {\fbox{\TRfamily #1}}%
+ {\TRfamily #1}}}%
+}
+
+\newcommand{\TRrightlabel}[1]{%
+ % Place a strut in order to set line depth
+ \mbox{}\strut\settodepth{\T@peReleaseDepth}{\strut}%
+ \vadjust{\hspace{\textwidth}\hspace{\marginparsep}%
+ \smash{\rlap{\TRwriteout{#1}}}}}
+
+\ifthenelse{\boolean{@twoside}}{
+ % Two-sided document
+ \newcommand{\TRleftlabel}[1]{%
+ % Place a strut in order to set line depth
+ \mbox{}\strut\settodepth{\T@peReleaseDepth}{\strut}%
+ \vadjust{\smash{\llap{\TRwriteout{#1}}\kern\marginparsep}}}
+}{
+ % Otherwise, the command is the same as rightlabel
+ \newcommand{\TRleftlabel}[1]{%
+ \TRrightlabel{#1}}
+}
+\ifthenelse{\boolean{RegisterTRFlags}}{
+\newcommand{\TR}[1]{%
+ \stepcounter{T@peReleaseTag}%
+ \label{TapeReleaseTag-\theT@peReleaseTag}%
+ \ifthenelse{\isodd{\GetTRPageRef{TapeReleaseTag-\theT@peReleaseTag}}}%
+ {\TRrightlabel{TR\hspace{1pt}#1}}%
+ {\TRleftlabel{TR\hspace{1pt}#1}}%
+}}
+{\newcommand{\TR}[1]{}}
+\endinput
+%%
+%% End of file `register.sty'.