summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/bytefield
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-05-19 00:11:02 +0000
committerKarl Berry <karl@freefriends.org>2008-05-19 00:11:02 +0000
commita95829d5460ae3a93a0d0dc2682ece85752d7474 (patch)
tree466b5afcf97d65f89975f3ef8071ac83c51049d0 /Master/texmf-dist/source/latex/bytefield
parent4ea09283f9abdb783e278db185a6ea5135918f3c (diff)
bytefield update (18may08)
git-svn-id: svn://tug.org/texlive/trunk@8217 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/bytefield')
-rw-r--r--Master/texmf-dist/source/latex/bytefield/bytefield.dtx153
-rw-r--r--Master/texmf-dist/source/latex/bytefield/bytefield.ins12
2 files changed, 146 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/bytefield/bytefield.dtx b/Master/texmf-dist/source/latex/bytefield/bytefield.dtx
index c5184b28d07..7504d58c68e 100644
--- a/Master/texmf-dist/source/latex/bytefield/bytefield.dtx
+++ b/Master/texmf-dist/source/latex/bytefield/bytefield.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2005 by Scott Pakin <scott+bf@pakin.org>
+% Copyright (C) 2008 by Scott Pakin <scott+bf@pakin.org>
% ------------------------------------------------------
%
% This file may be distributed and/or modified under the
@@ -10,8 +10,8 @@
%
% http://www.latex-project.org/lppl.txt
%
-% and version 1.3a or later is part of all distributions of LaTeX
-% version 2004/10/11 or later.
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2006/05/20 or later.
%
% \fi
%
@@ -29,8 +29,11 @@
\documentclass{ltxdoc}
\usepackage{textcomp}
\usepackage{bytefield}
+\usepackage{color}
+\usepackage{rotating}
+\usepackage{calc}
+\usepackage{array}
\IfFileExists{hyperref.sty}{%
- \usepackage{color}
\usepackage{hyperref}
\definecolor{darkred}{rgb}{0.5,0,0}
\definecolor{darkgreen}{rgb}{0,0.3,0}
@@ -40,7 +43,8 @@
pdftitle={The bytefield package},
pdfauthor={Scott Pakin <scott+bf@pakin.org>},
pdfsubject={Protocol diagrams for LaTeX},
- pdfkeywords={bits, bytes, bitfields, protocol diagrams, LaTeX, memory maps},
+ pdfkeywords={bits, bytes, bit fields, communication, network protocol
+ diagrams, LaTeX2e, memory maps},
bookmarksopen=true,
colorlinks=true,
citecolor=darkblue,
@@ -491,16 +495,67 @@
% \noindent
% The extra |1ex| of vertical space helps center the |\vdots| a bit better.
%
+% \paragraph{Narrow fields}
+% There are a number of options for labeling a narrow field (e.g.,~one
+% occupying a single bit):
+%
+% \newsavebox{\defaultOK}
+% \begin{lrbox}{\defaultOK}
+% \begin{bytefield}{8}
+% \bitbox{1}{OK} & \bitbox{7}{Data} \\
+% \end{bytefield}
+% \end{lrbox}
+%
+% \newsavebox{\bitwidthOK}
+% \begin{lrbox}{\bitwidthOK}
+% \settowidth{\bitwidth}{OK~}\relax
+% \begin{bytefield}{8}
+% \bitbox{1}{OK} & \bitbox{7}{Data} \\
+% \end{bytefield}
+% \end{lrbox}
+%
+% \newsavebox{\tinyOK}
+% \begin{lrbox}{\tinyOK}
+% \begin{bytefield}{8}
+% \bitbox{1}{\tiny OK} & \bitbox{7}{Data} \\
+% \end{bytefield}
+% \end{lrbox}
+%
+% \newsavebox{\verticalOK}
+% \begin{lrbox}{\verticalOK}
+% \begin{bytefield}{8}
+% \bitbox{1}{\tiny O \\ K} & \bitbox{7}{Data} \\
+% \end{bytefield}
+% \end{lrbox}
+%
+% \newsavebox{\rotateOK}
+% \begin{lrbox}{\rotateOK}
+% \begin{bytefield}{8}
+% \bitbox{1}{\rotatebox{90}{\small OK}} & \bitbox{7}{Data} \\
+% \end{bytefield}
+% \end{lrbox}
+%
+% \bigskip
+%
+% \begin{tabular}{ll}
+% \emph{Default}: & \raisebox{-4ex}{\usebox{\defaultOK}} \\
+% |\settowidth{\bitwidth}{OK~}|: & \raisebox{-4ex}{\usebox{\bitwidthOK}} \\
+% |\tiny OK|: & \raisebox{-4ex}{\usebox{\tinyOK}} \\
+% |\tiny O \\ K|: & \raisebox{-4ex}{\usebox{\verticalOK}} \\
+% |\rotatebox{90}{\small OK}|: & \raisebox{-4ex}{\usebox{\rotateOK}} \\
+% \end{tabular}
+%
% \paragraph{Unused bits}
% Because |\width| and |\height| are defined within |\bitbox|es (also
% |\wordbox|es), we can represent unused bits by filling a |\bitbox|
-% with a rule of size |\width|~$\times$| \height|.
+% with a rule of size |\width|~$\times$ |\height|:
%
% \begin{verbatim}
% \begin{bytefield}{32}
% \bitheader{0,4,8,12,16,20,24,28} \\
% \bitbox{8}{Tag} & \bitbox{8}{Value} &
-% \bitbox{4}{\rule{\width}{\height}} & \bitbox{12}{Mask} \\
+% \bitbox{4}{\rule{\width}{\height}} &
+% \bitbox{12}{Mask} \\
% \wordbox{1}{Key}
% \end{bytefield}
% \end{verbatim}
@@ -509,7 +564,8 @@
% \begin{bytefield}{32}
% \bitheader{0,4,8,12,16,20,24,28} \\
% \bitbox{8}{Tag} & \bitbox{8}{Value} &
-% \bitbox{4}{\rule{\width}{\height}} & \bitbox{12}{Mask} \\
+% \bitbox{4}{\rule{\width}{\height}} &
+% \bitbox{12}{Mask} \\
% \wordbox{1}{Key}
% \end{bytefield}
% \end{bffigure}
@@ -518,8 +574,77 @@
% The effect is much better when the \texttt{color} package is used to
% draw the unused bits in color. (Gray looks nice.)
%
+% \begin{verbatim}
+% \definecolor{lightgray}{gray}{0.8}
+% \begin{bytefield}{32}
+% \bitheader{0,4,8,12,16,20,24,28} \\
+% \bitbox{8}{Tag} & \bitbox{8}{Value} &
+% \bitbox{4}{\color{lightgray}\rule{\width}{\height}} &
+% \bitbox{12}{Mask} \\
+% \wordbox{1}{Key}
+% \end{bytefield}
+% \end{verbatim}
+%
+% \definecolor{lightgray}{gray}{0.8}
+% \begin{bffigure}
+% \begin{bytefield}{32}
+% \bitheader{0,4,8,12,16,20,24,28} \\
+% \bitbox{8}{Tag} & \bitbox{8}{Value} &
+% \bitbox{4}{\color{lightgray}\rule{\width}{\height}} &
+% \bitbox{12}{Mask} \\
+% \wordbox{1}{Key}
+% \end{bytefield}
+% \end{bffigure}
+%
% \subsection{Not-so-common tricks}
%
+% \paragraph{Colored fields}
+% A similar approach to that utilized to indicate unused bits can be
+% applied to coloring an individual bit field. The trick is to use the
+% \TeX\ |\rlap| primitive to draw a colored box that overlaps whatever
+% follows it to the right:
+%
+% \begin{verbatim}
+% \begingroup
+% \small
+% \newcommand{\colorbitbox}[3]{%
+% \rlap{\bitbox{#2}{\color{#1}\rule{\width}{\height}}}%
+% \bitbox{#2}{#3}}
+% \definecolor{lightcyan}{rgb}{0.84,1,1}
+% \definecolor{lightgreen}{rgb}{0.64,1,0.71}
+% \definecolor{lightred}{rgb}{1,0.7,0.71}
+%
+% \settowidth{\byteheight}{~Sign~}
+% \setlength{\bitwidth}{\baselineskip}
+% \begin{bytefield}{32}
+% \bitheader[b]{31,23,0} \\
+% \colorbitbox{lightcyan}{1}{\rotatebox{90}{Sign}} &
+% \colorbitbox{lightgreen}{8}{Exponent} &
+% \colorbitbox{lightred}{23}{Mantissa} \\
+% \end{bytefield}
+% \endgroup
+% \end{verbatim}
+%
+% \begin{center}
+% \small
+% \newcommand{\colorbitbox}[3]{%
+% \rlap{\bitbox{#2}{\color{#1}\rule{\width}{\height}}}^^A
+% \bitbox{#2}{#3}}
+% \definecolor{lightcyan}{rgb}{0.84,1,1}
+% \definecolor{lightgreen}{rgb}{0.64,1,0.71}
+% \definecolor{lightred}{rgb}{1,0.7,0.71}
+%
+% \settowidth{\byteheight}{~Sign~}
+% \setlength{\bitwidth}{\baselineskip}
+% \begin{bytefield}{32}
+% \bitheader[b]{31,23,0} \\
+% \colorbitbox{lightcyan}{1}{\rotatebox{90}{Sign}} &
+% \colorbitbox{lightgreen}{8}{Exponent} &
+% \colorbitbox{lightred}{23}{Mantissa} \\
+% \end{bytefield}
+% \end{center}
+%
+% \paragraph{Memory-map diagrams}
% While certainly not the intended purpose of the \texttt{bytefield}
% package, one can utilize |\wordbox|es with empty \meta{sides} and
% word labels to produce memory-map diagrams:
@@ -539,7 +664,7 @@
% \bitbox[]{8}{\texttt{0xBFFFFFFF} \\[2\baselineskip]
% \texttt{0x80000000}} &
% \bitbox{24}{\descbox{1\,GB area for memory-mapped files,
-% shared system DLLs, file system code; shared by all
+% shared system \textsc{dll}s, file system code; shared by all
% processes.}{Read/writable.}}
% \endwordgroupr \\
% \wordgroupr{Partition 2}
@@ -556,7 +681,8 @@
% \bitbox[]{8}{\texttt{0x00000FFF} \\[2\baselineskip]
% \texttt{0x00000000}} &
% \bitbox{24}{\descbox{4096~byte area for MS-DOS and Windows~3.1
-% compatibility.}{Protected---catches {\small NULL} pointers.}}
+% compatibility.}{Protected---catches \textsc{null}
+% pointers.}}
% \endwordgroupr \\
% \end{verbatim}
%
@@ -575,7 +701,7 @@
% \bitbox[]{8}{\texttt{0xBFFFFFFF} \\[2\baselineskip]
% \texttt{0x80000000}} &
% \bitbox{24}{\descbox{1\,GB area for memory-mapped files,
-% shared system DLLs, file system code; shared by all
+% shared system \textsc{dll}s, file system code; shared by all
% processes.}{Read/writable.}}
% \endwordgroupr \\
% \wordgroupr{Partition 2}
@@ -592,7 +718,8 @@
% \bitbox[]{8}{\texttt{0x00000FFF} \\[2\baselineskip]
% \texttt{0x00000000}} &
% \bitbox{24}{\descbox{4096~byte area for MS-DOS and Windows~3.1
-% compatibility.}{Protected---catches {\small NULL} pointers.}}
+% compatibility.}{Protected---catches \textsc{null}
+% pointers.}}
% \endwordgroupr \\
% \end{bytefield}
% \end{bffigure}
@@ -708,7 +835,7 @@
% too late---is that \cseq\begin\ellipsis\cseq\end\ blocks are unable to
% cross cells of an \cseq\ialign\ (or \texttt{tabular} environment, for
% that matter).
-%
+%
% That said, I'd like the next major release of \texttt{bytefield} to
% let the user use \texttt{\cseq\begin\char'173
% wordgroup\char'175[r]}\ellipsis \texttt{\cseq\end\char'173
diff --git a/Master/texmf-dist/source/latex/bytefield/bytefield.ins b/Master/texmf-dist/source/latex/bytefield/bytefield.ins
index 4f762755f2c..1957cc355b2 100644
--- a/Master/texmf-dist/source/latex/bytefield/bytefield.ins
+++ b/Master/texmf-dist/source/latex/bytefield/bytefield.ins
@@ -1,5 +1,5 @@
%%
-%% Copyright (C) 2005 by Scott Pakin <scott+bf@pakin.org>
+%% Copyright (C) 2008 by Scott Pakin <scott+bf@pakin.org>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3a of this license
@@ -8,8 +8,8 @@
%%
%% http://www.latex-project.org/lppl.txt
%%
-%% and version 1.3a or later is part of all distributions of LaTeX version
-%% 2004/10/11 or later.
+%% and version 1.3c or later is part of all distributions of LaTeX version
+%% 2006/05/20 or later.
%%
\input docstrip.tex
@@ -21,7 +21,7 @@
This is a generated file.
-Copyright (C) 2005 by Scott Pakin <scott+bf@pakin.org>
+Copyright (C) 2008 by Scott Pakin <scott+bf@pakin.org>
This file may be distributed and/or modified under the conditions of
the LaTeX Project Public License, either version 1.3a of this license
@@ -30,8 +30,8 @@ license is in:
http://www.latex-project.org/lppl.txt
-and version 1.3a or later is part of all distributions of LaTeX version
-2004/10/11 or later.
+and version 1.3c or later is part of all distributions of LaTeX version
+2006/05/20 or later.
\endpreamble