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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
|
%%
%% This is file `bytefield.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bytefield.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2000-2021 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
%% or (at your option) any later version. The latest version of this
%% license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2006/05/20 or later.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{bytefield}
[2021/08/17 v2.7 Network protocol diagrams]
\RequirePackage{calc}[1998/07/07]
\RequirePackage{keyval}
\def\bf@newdimen#1{\advance\count11 by 1
\ch@ck1\insc@unt\dimen
\allocationnumber=\count11
\dimendef#1=\allocationnumber
\wlog{\string#1=\string\dimen\the\allocationnumber\space (locally)}%
}
\AtBeginDocument{%
\expandafter\ifx\csname e@alloc\endcsname\relax
\expandafter\ifx\csname locdimen\endcsname\relax
\else
\let\bf@newdimen=\locdimen
\fi
\else
\let\bf@newdimen=\newdimen
\fi
}
\newlength{\bytefield@height}
\newif\ifcounting@words
\newlength{\bytefield@height@increment}
\DeclareRobustCommand{\inc@bytefield@height}[1]{%
\setlength{\bytefield@height@increment}{#1}%
\global\advance\bytefield@height by \bytefield@height@increment
}
\newsavebox{\entire@bytefield@picture}
\newenvironment{bytefield}[2][]{%
\bf@bytefieldsetup{#1}%
\renewcommand{\baselinestretch}{}%
\selectfont
\def\bits@wide{#2}%
\let\old@nl=\\%
\let\amp=&%
\catcode`\&=10
\openup -1pt
\setlength{\bytefield@height}{0pt}%
\setlength{\unitlength}{1pt}%
\global\counting@wordstrue
\begin{lrbox}{\entire@bytefield@picture}%
\renewcommand{\\}[1][0pt]{%
\unskip
\vspace{##1}%
\amp\show@wordlabelr\cr
\ignorespaces\global\counting@wordstrue\make@lspace\amp}%
\vbox\bgroup\ialign\bgroup##\amp##\amp##\cr\amp
}{%
\unskip
\amp\show@wordlabelr\cr\egroup\egroup
\end{lrbox}%
\usebox{\entire@bytefield@picture}%
}
\newcommand*{\bf@bitformatting}{\tiny}
\newcommand*{\bf@boxformatting}{\centering}
\newlength{\bf@bitwidth}
\settowidth{\bf@bitwidth}{\bf@bitformatting{99i}}
\newlength{\bf@bitheight}
\setlength{\bf@bitheight}{4ex}
\newlength{\units@wide}
\newlength{\units@tall}
\newcommand*{\bf@call@box@cmd}[1]{%
\def\bf@call@box@func{#1}%
\bf@call@box@cmd@i
}
\newcommand*{\bf@call@box@cmd@i}[2][lrtb]{%
\def\bf@call@box@arg@i{#1}%
\def\bf@call@box@arg@ii{#2}%
\bf@call@box@cmd@ii
}
\newcommand*{\bf@call@box@cmd@ii}[2][]{%
\def\bf@call@box@arg@iii{#1}%
\def\bf@call@box@arg@iv{#2}%
\bf@call@box@func
}
\DeclareRobustCommand{\bitbox}{\bf@call@box@cmd{\bf@bitbox}}
\def\bf@bitbox{%
\bgroup
\expandafter\bf@parse@bitbox@arg\expandafter{\bf@call@box@arg@i}%
\setlength{\units@wide}{\bf@bitwidth * \bf@call@box@arg@ii}%
\expandafter\bf@bytefieldsetup\expandafter{\bf@call@box@arg@iii}%
\@ifundefined{bf@bgcolor}{%
}{%
\rlap{%
\draw@bit@picture{\strip@pt\units@wide}{\strip@pt\bf@bitheight}{%
\color{\bf@bgcolor}%
\rule{\width}{\height}%
}%
}%
}%
\draw@bit@picture{\strip@pt\units@wide}{\strip@pt\bf@bitheight}{%
\bf@call@box@arg@iv
}%
\egroup
\ignorespaces
}
\DeclareRobustCommand{\wordbox}{\bf@call@box@cmd{\bf@wordbox}}
\def\bf@wordbox{%
\bgroup
\expandafter\bf@parse@bitbox@arg\expandafter{\bf@call@box@arg@i}%
\setlength{\units@wide}{\bf@bitwidth * \bits@wide}%
\setlength{\units@tall}{\bf@bitheight * \bf@call@box@arg@ii}%
\expandafter\bf@bytefieldsetup\expandafter{\bf@call@box@arg@iii}%
\@ifundefined{bf@bgcolor}{%
}{%
\rlap{%
\draw@bit@picture{\strip@pt\units@wide}{\strip@pt\units@tall}{%
\color{\bf@bgcolor}%
\rule{\width}{\height}%
}%
}%
}%
\draw@bit@picture{\strip@pt\units@wide}{\strip@pt\units@tall}{%
\bf@call@box@arg@iv
}%
\@ifundefined{bf@per@word}{}{\bf@invoke@per@word{\bf@call@box@arg@ii}}%
\egroup
\ignorespaces
}
\DeclareRobustCommand{\draw@bit@picture}[3]{%
\begin{picture}(#1,#2)%
\put(0,0){\makebox(#1,#2){\parbox{#1\unitlength}{%
\bf@set@user@dimens{#1}{#2}%
\bf@boxformatting{#3\par}}}}%
\ifbitbox@top
\put(0,#2){\line(1,0){#1}}%
\fi
\ifbitbox@bottom
\put(0,0){\line(1,0){#1}}%
\fi
\ifbitbox@left
\put(0,0){\line(0,1){#2}}%
\fi
\ifbitbox@right
\put(#1,0){\line(0,1){#2}}%
\fi
\end{picture}%
\ifcounting@words
\inc@bytefield@height{\unitlength * \real{#2}}%
\global\counting@wordsfalse
\fi
}
\newcommand{\bf@invoke@per@word}[1]{%
\begin{picture}(0,0)%
\@tempcnta=0
\@tempdima=#1\bf@bitheight
\bf@set@user@dimens{\strip@pt\units@wide}{\strip@pt\units@tall}%
\loop
\advance\@tempdima by -\bf@bitheight
\bgroup
\put(-\strip@pt\units@wide, \strip@pt\@tempdima){%
\expandafter\bf@per@word\expandafter{\the\@tempcnta}{#1}%
}%
\egroup
\advance\@tempcnta by 1\relax
\ifnum#1>\@tempcnta
\repeat
\end{picture}%
}
\newcommand{\bf@set@user@dimens}[2]{%
\bf@newdimen\width
\bf@newdimen\height
\bf@newdimen\depth
\bf@newdimen\totalheight
\width=#1\unitlength
\height=#2\unitlength
\depth=0pt%
\totalheight=#2\unitlength
\def\widthunits{#1}%
\def\heightunits{#2}%
}
\DeclareRobustCommand{\bitboxes}{%
\@ifstar
{\bf@call@box@cmd{\bf@bitboxes@star}}%
{\bf@call@box@cmd{\bf@bitboxes@no@star}}%
}
\def\bf@relax{\relax}
\def\bf@bitboxes@no@star{%
\expandafter\bf@bitboxes@no@star@i\bf@call@box@arg@iv\relax
\ignorespaces
}
\def\bf@bitboxes@no@star@i#1{%
\def\bf@call@box@arg@iv{#1}%
\ifx\bf@call@box@arg@iv\bf@relax
\let\next=\relax
\else
\bf@bitbox
\let\next=\bf@bitboxes@no@star@i
\fi
\next
}
\def\bf@bitboxes@star{%
\edef\bf@bitboxes@sides{\bf@call@box@arg@i}%
\expandafter\bf@bitboxes@star@i\bf@call@box@arg@iv\relax\relax
\ignorespaces
}
\def\bf@bitboxes@star@i#1#2{%
\def\bf@call@box@arg@iv{#1}%
\def\bf@bitboxes@arg@ii{#2}%
\ifx\bf@bitboxes@arg@ii\bf@relax
\bf@bitbox
\let\next=\relax
\else
\edef\bf@call@box@arg@i{\bf@bitboxes@sides R}%
\bf@bitbox
\def\next{\bf@bitboxes@star@ii{#2}}%
\fi
\next
}
\def\bf@bitboxes@star@ii#1#2{%
\def\bf@call@box@arg@iv{#1}%
\def\bf@bitboxes@arg@ii{#2}%
\ifx\bf@bitboxes@arg@ii\bf@relax
\edef\bf@call@box@arg@i{\bf@bitboxes@sides L}%
\else
\edef\bf@call@box@arg@i{\bf@bitboxes@sides LR}%
\fi
\ifx\bf@call@box@arg@iv\bf@relax
\let\next=\relax
\else
\bf@bitbox
\def\next{\bf@bitboxes@star@ii{#2}}%
\fi
\next
}
\newif\ifbitbox@top
\newif\ifbitbox@bottom
\newif\ifbitbox@left
\newif\ifbitbox@right
\def\bf@parse@bitbox@arg#1{%
\bitbox@topfalse
\bitbox@bottomfalse
\bitbox@leftfalse
\bitbox@rightfalse
\bf@parse@bitbox@sides#1X%
}
\def\bf@parse@bitbox@sides#1{%
\ifx#1X%
\else
\ifx#1t%
\bitbox@toptrue
\else
\ifx#1b%
\bitbox@bottomtrue
\else
\ifx#1l%
\bitbox@lefttrue
\else
\ifx#1r%
\bitbox@righttrue
\else
\ifx#1T%
\bitbox@topfalse
\else
\ifx#1B%
\bitbox@bottomfalse
\else
\ifx#1L%
\bitbox@leftfalse
\else
\ifx#1R%
\bitbox@rightfalse
\else
\PackageWarning{bytefield}{Unrecognized box side `#1'}%
\fi
\fi
\fi
\fi
\fi
\fi
\fi
\fi
\expandafter\bf@parse@bitbox@sides
\fi
}
\newlength{\units@high}
\DeclareRobustCommand{\skippedwords}[1][2ex]{%
\setlength{\units@wide}{\bf@bitwidth * \bits@wide}%
\setlength{\units@high}{1pt * \ratio{\units@wide}{6.0pt}}%
\setlength{\units@tall}{#1 + \units@high}%
\edef\num@wide{\strip@pt\units@wide}%
\edef\num@tall{\strip@pt\units@tall}%
\edef\num@high{\strip@pt\units@high}%
\begin{picture}(\num@wide,\num@tall)
\put(0,\num@tall){\line(6,-1){\num@wide}}
\put(\num@wide,0){\line(-6,1){\num@wide}}
\put(0,0){\line(0,1){\num@high}}
\put(\num@wide,\num@tall){\line(0,-1){\num@high}}
\end{picture}%
\ifcounting@words
\inc@bytefield@height{\unitlength * \real{\num@tall}}%
\global\counting@wordsfalse
\fi
}
\newcommand*{\bf@bit@endianness}{l}
\newcommand*{\bf@first@bit}{0}
\DeclareRobustCommand{\bitheader}[2][]{%
\bf@parse@bitbox@arg{lrtb}%
\setlength{\units@wide}{\bf@bitwidth * \bits@wide}%
\setlength{\units@tall}{\heightof{\bf@bitformatting{1234567890}}}%
\setlength{\units@high}{\units@tall * -1}%
\bf@process@bitheader@opts{#1}%
\begin{picture}(\strip@pt\units@wide,\strip@pt\units@tall)%
(0,\strip@pt\units@high)
\bf@parse@range@list#2,X,
\end{picture}%
\ifcounting@words
\inc@bytefield@height{\unitlength * \real{\strip@pt\units@tall}}%
\global\counting@wordsfalse
\fi
\ignorespaces
}
\def\bf@parse@range@list#1,{%
\ifx X#1
\else
\bf@parse@range#1-#1-#1\relax
\expandafter\bf@parse@range@list
\fi
}
\newlength{\header@xpos}
\newcounter{header@val}
\newcounter{max@header@val}
\def\bf@parse@range#1-#2-#3\relax{%
\setcounter{header@val}{#1}
\setcounter{max@header@val}{#2 + 1}
\loop
\ifnum\value{header@val}<\value{max@header@val}%
\if\bf@bit@endianness b%
\setlength{\header@xpos}{%
\bf@bitwidth * (\bits@wide - \value{header@val} + \bf@first@bit - 1)}%
\else
\setlength{\header@xpos}{\bf@bitwidth * (\value{header@val} - \bf@first@bit)}%
\fi
\put(\strip@pt\header@xpos,0){%
\makebox(\strip@pt\bf@bitwidth,\strip@pt\units@tall){%
\bf@bitformatting{\theheader@val}}}
\addtocounter{header@val}{1}
\repeat
}
\newcommand*{\bf@process@bitheader@opts}{%
\let\KV@bytefield@l=\KV@bitheader@l
\let\KV@bytefield@b=\KV@bitheader@b
\let\KV@bytefield@l@default=\KV@bitheader@l@default
\let\KV@bytefield@b@default=\KV@bitheader@b@default
\setkeys{bytefield}%
}
\define@key{bitheader}{l}[true]{%
\expandafter\ifx\csname curlyshrinkage\endcsname\relax
\PackageWarning{bytefield}{%
The "l" argument to \protect\bitheader\space is deprecated.\MessageBreak
Instead, please use "endianness=little", which can\MessageBreak
even be declared globally for the entire document.\MessageBreak
This warning occurred}%
\fi
\def\bf@bit@endianness{l}%
}
\define@key{bitheader}{b}[true]{%
\expandafter\ifx\csname curlyshrinkage\endcsname\relax
\PackageWarning{bytefield}{%
The "b" argument to \protect\bitheader\space is deprecated.\MessageBreak
Instead, please use "endianness=big", which can\MessageBreak
even be declared globally for the entire document.\MessageBreak
This warning occurred}%
\fi
\def\bf@bit@endianness{b}%
}
\def\bf@leftcurlyshrinkage{5pt}
\def\bf@rightcurlyshrinkage{5pt}
\def\bf@leftcurlyspace{1ex}
\def\bf@rightcurlyspace{1ex}
\def\bf@leftlabelspace{0.5ex}
\def\bf@rightlabelspace{0.5ex}
\let\bf@leftcurly=\{
\let\bf@rightcurly=\}
\let\bf@leftcurlystyle=\relax
\let\bf@rightcurlystyle=\relax
\newbox{\curly@box}
\def\store@rcurly#1#2{%
\begingroup
\bf@newdimen\curly@height
\setlength{\curly@height}{#2 - \bf@rightcurlyshrinkage}%
\bf@newdimen\half@curly@height
\setlength{\half@curly@height}{0.5\curly@height}%
\bf@newdimen\curly@shift
\setlength{\curly@shift}{\bf@rightcurlyshrinkage}%
\setlength{\curly@shift}{\half@curly@height + 0.5\curly@shift}%
\addtolength{\curly@shift}{-\fontdimen22\textfont2}%
\global\sbox{#1}{\raisebox{\curly@shift}{%
\bf@rightcurlystyle{%
$\left.
\vrule height\half@curly@height
width 0pt
depth\half@curly@height\right\bf@rightcurly$%
}%
}}%
\endgroup
}
\def\store@lcurly#1#2{%
\begingroup
\bf@newdimen\curly@height
\setlength{\curly@height}{#2 - \bf@leftcurlyshrinkage}%
\bf@newdimen\half@curly@height
\setlength{\half@curly@height}{0.5\curly@height}%
\bf@newdimen\curly@shift
\setlength{\curly@shift}{\bf@leftcurlyshrinkage}%
\setlength{\curly@shift}{\half@curly@height + 0.5\curly@shift}%
\addtolength{\curly@shift}{-\fontdimen22\textfont2}%
\global\sbox{#1}{\raisebox{\curly@shift}{%
\bf@leftcurlystyle{%
$\left\bf@leftcurly
\vrule height\half@curly@height
width 0pt
depth\half@curly@height\right.$%
}%
}}%
\endgroup
}
\def\show@wordlabelr{}
\newlength{\wordlabelr@start}
\newlength{\wordlabelr@end}
\newenvironment{rightwordgroup}[2][]{%
\endgroup
\global\wordlabelr@start=\bytefield@height
\gdef\wordlabelr@params{#1}%
\gdef\wordlabelr@text{#2}%
\ignorespaces
}{%
\begingroup
\global\wordlabelr@end=\bytefield@height
\gdef\show@wordlabelr{%
\sbox{\word@label@box}{%
\begin{tabular}[b]{@{}l@{}}\wordlabelr@text\end{tabular}%
}%
\settowidth{\label@box@width}{\usebox{\word@label@box}}%
\setlength{\label@box@height}{\wordlabelr@end-\wordlabelr@start}%
\expandafter\bf@bytefieldsetup\expandafter{\wordlabelr@params}%
\store@rcurly{\curly@box}{\label@box@height}%
\bf@newdimen\total@box@width
\setlength{\total@box@width}{%
\bf@rightcurlyspace +
\widthof{\usebox{\curly@box}} +
\bf@rightlabelspace +
\label@box@width
}%
\begin{picture}(\strip@pt\total@box@width,0)
\put(0,0){%
\hspace*{\bf@rightcurlyspace}%
\usebox{\curly@box}%
\hspace*{\bf@rightlabelspace}%
\makebox(\strip@pt\label@box@width,\strip@pt\label@box@height){%
\usebox{\word@label@box}%
}%
}%
\end{picture}%
\gdef\show@wordlabelr{}}%
\def\@currenvir{rightwordgroup}%
\ignorespacesafterend
}
\newlength{\wordlabell@start}
\newlength{\wordlabell@end}
\newlength{\total@lbox@width}
\gdef\make@lspace{}
\newenvironment{leftwordgroup}[2][]{%
\global\wordlabell@start=\bytefield@height
\gdef\wordlabell@params{#1}%
\gdef\wordlabell@text{#2}%
\bf@bytefieldsetup{#1}%
\sbox{\word@label@box}{%
\begin{tabular}[b]{@{}l@{}}\wordlabell@text\end{tabular}}%
\settowidth{\label@box@width}{\usebox{\word@label@box}}%
\store@lcurly{\curly@box}{5cm}%
\setlength{\total@lbox@width}{%
\bf@leftcurlyspace +
\widthof{\usebox{\curly@box}} +
\bf@leftlabelspace +
\label@box@width}%
\global\total@lbox@width=\total@lbox@width
\gdef\make@lspace{%
\hspace*{\total@lbox@width}%
\gdef\make@lspace{}%
}%
\endgroup
\ignorespaces
}{%
\begingroup
\global\wordlabell@end=\bytefield@height
\bf@newdimen\starting@point
\setlength{\starting@point}{%
-\total@lbox@width - \bf@bitwidth*\bits@wide}%
\sbox{\word@label@box}{%
\begin{tabular}[b]{@{}l@{}}\wordlabell@text\end{tabular}}%
\settowidth{\label@box@width}{\usebox{\word@label@box}}%
\setlength{\label@box@height}{\wordlabell@end-\wordlabell@start}%
\expandafter\bf@bytefieldsetup\expandafter{\wordlabell@params}%
\store@lcurly{\curly@box}{\label@box@height}%
\begin{picture}(0,0)
\put(\strip@pt\starting@point,0){%
\makebox(\strip@pt\label@box@width,\strip@pt\label@box@height){%
\usebox{\word@label@box}}%
\hspace*{\bf@leftlabelspace}%
\usebox{\curly@box}%
\hspace*{\bf@leftcurlyspace}}
\end{picture}%
\def\@currenvir{leftwordgroup}%
\ignorespacesafterend
}
\newlength{\label@box@width}
\newlength{\label@box@height}
\newsavebox{\word@label@box}
\newcommand{\bf@enter@compatibility@mode@i}{%
\PackageInfo{bytefield}{Entering version 1 compatibility mode}%
\newlength{\bitwidth}%
\newlength{\byteheight}%
\newlength{\curlyspace}%
\newlength{\labelspace}%
\newlength{\curlyshrinkage}%
\settowidth{\bitwidth}{\tiny 99i}%
\setlength{\byteheight}{4ex}%
\setlength{\curlyspace}{1ex}%
\setlength{\labelspace}{0.5ex}%
\setlength{\curlyshrinkage}{5pt}%
\let\newbytefield=\bytefield
\let\endnewbytefield=\endbytefield
\renewenvironment{bytefield}[1]{%
\begin{newbytefield}[%
bitwidth=\bitwidth,
bitheight=\byteheight,
curlyspace=\curlyspace,
labelspace=\labelspace,
curlyshrinkage=\curlyshrinkage]{##1}%
}{%
\end{newbytefield}%
}
\def\wordgroupr{\begin{rightwordgroup}}
\def\endwordgroupr{\end{rightwordgroup}}
\def\wordgroupl{\begin{leftwordgroup}}
\def\endwordgroupl{\end{leftwordgroup}}
\renewcommand{\bytefieldsetup}[1]{%
\PackageError{bytefield}{%
The \protect\bytefieldsetup\space macro is not available in\MessageBreak
version 1 compatibility mode%
}{%
Remove [compat1] from the \protect\usepackage{bytefield} line to
make \protect\bytefieldsetup\MessageBreak
available to this document.\space\space (The document may also need
to be modified to use\MessageBreak
the new bytefield interface.)
}%
}%
}
\newcommand{\wordgroupr}{%
\PackageError{bytefield}{%
Macros \protect\wordgroupr, \protect\wordgroupl, \protect\endwordgroupr,
\MessageBreak
and \protect\endwordgroupl\space no longer exist%
}{%
Starting with version 2.0, bytefield uses \protect\begin{wordgroupr}...
\MessageBreak
\protect\end{wordgroupr} and \protect\begin{wordgroupl}...%
\protect\end{wordgroupl}\MessageBreak
to specify word groups and a new \protect\bytefieldsetup\space macro to
\MessageBreak
change bytefield's various formatting parameters.%
}%
}
\let\endwordgroupr=\wordgroupr
\let\wordgroupl=\wordgroupr
\let\endwordgroupl=\wordgroupr
\define@key{bytefield}{bitwidth}{%
\def\bf@bw@arg{#1}%
\def\bf@auto{auto}%
\ifx\bf@bw@arg\bf@auto
\settowidth{\bf@bitwidth}{\bf@bitformatting{99i}}%
\else
\setlength{\bf@bitwidth}{#1}%
\fi
}
\define@key{bytefield}{bitheight}{\setlength{\bf@bitheight}{#1}}
\define@key{bytefield}{bitformatting}{\def\bf@bitformatting{#1}}
\define@key{bytefield}{boxformatting}{\def\bf@boxformatting{#1}}
\define@key{bytefield}{leftcurly}{\def\bf@leftcurly{#1}}
\define@key{bytefield}{rightcurly}{\def\bf@rightcurly{#1}}
\define@key{bytefield}{leftcurlyspace}{\def\bf@leftcurlyspace{#1}}
\define@key{bytefield}{rightcurlyspace}{\def\bf@rightcurlyspace{#1}}
\define@key{bytefield}{curlyspace}{%
\def\bf@leftcurlyspace{#1}%
\def\bf@rightcurlyspace{#1}%
}
\define@key{bytefield}{leftlabelspace}{\def\bf@leftlabelspace{#1}}
\define@key{bytefield}{rightlabelspace}{\def\bf@rightlabelspace{#1}}
\define@key{bytefield}{labelspace}{%
\def\bf@leftlabelspace{#1}%
\def\bf@rightlabelspace{#1}%
}
\define@key{bytefield}{leftcurlyshrinkage}{\def\bf@leftcurlyshrinkage{#1}}
\define@key{bytefield}{rightcurlyshrinkage}{\def\bf@rightcurlyshrinkage{#1}}
\define@key{bytefield}{curlyshrinkage}{%
\def\bf@leftcurlyshrinkage{#1}%
\def\bf@rightcurlyshrinkage{#1}%
}
\define@key{bytefield}{leftcurlystyle}{\def\bf@leftcurlystyle{#1}}
\define@key{bytefield}{rightcurlystyle}{\def\bf@rightcurlystyle{#1}}
\define@key{bytefield}{curlystyle}{%
\def\bf@leftcurlystyle{#1}%
\def\bf@rightcurlystyle{#1}%
}
\define@key{bytefield}{endianness}{\bf@parse@endianness{#1}}
\newcommand{\bf@parse@endianness}[1]{%
\def\bf@little{little}%
\def\bf@big{big}%
\def\bf@arg{#1}%
\ifx\bf@arg\bf@little
\def\bf@bit@endianness{l}%
\else
\ifx\bf@arg\bf@big
\def\bf@bit@endianness{b}%
\else
\PackageError{bytefield}{%
Invalid argument "#1" to the endianness option%
}{%
The endianness option must be set to either "little" or
"big".\MessageBreak
Please specify either endianness=little or endianness=big.
}%
\fi
\fi
}
\define@key{bytefield}{lsb}{\def\bf@first@bit{#1}}
\define@key{bytefield}{bgcolor}{\def\bf@bgcolor{#1}}
\define@key{bytefield}{perword}{\def\bf@per@word{#1}}
\newcommand{\bf@bytefieldsetup}{\setkeys{bytefield}}
\let\bytefieldsetup=\bf@bytefieldsetup
\DeclareOption{compat1}{\bf@enter@compatibility@mode@i}
\def\bf@package@options{}
\DeclareOption*{%
\edef\next{%
\noexpand\g@addto@macro\noexpand\bf@package@options{,\CurrentOption}%
}%
\next
}
\ProcessOptions\relax
\expandafter\bf@bytefieldsetup\expandafter{\bf@package@options}
\endinput
%%
%% End of file `bytefield.sty'.
|