Final Review Draft...
[dwarf-doc.git] / dwarf5 / latexdoc / dwarf5.tex
1 \documentclass[12pt,letterpaper,oneside]{memoir} 
2 % for debugging, add 'draft' (without quotes) to the [] document class list.
3 % If draft is in the document class list, pix are just suggested
4 % by an outline, the pic does not appear as a picture.
5 %
6 \newcommand{\docdate}{February 3, 2017}
7 %
8 \usepackage{ifthen}
9     \newcommand{\ifthen}[2]{\ifthenelse{#1}{#2}{}}
10     \newboolean{isdraft}\setboolean{isdraft}{true}
11     \newboolean{uselinenumbers}\setboolean{uselinenumbers}{true}
12     \newboolean{usechangesummary}\setboolean{usechangesummary}{false}
13 \newcommand{\draftmark}{\ifthenelse{\boolean{isdraft}}{***FINAL REVIEW DRAFT***}{}}
14 %
15 \usepackage[T1]{fontenc}
16 \usepackage{palatino}
17 \usepackage{cmtt}
18     \renewcommand{\ttdefault}{cmtt}     % Use Computer Modern Typewriter instead of Courier
19 \usepackage{url}           % for color in letters. Links instead?
20 \usepackage[usenames]{color}%for color in letters. Links instead?
21 \usepackage{ellipsis}      % provides ... as \dots
22 %\usepackage[utf8]{inputenc}% to type directly diacritic characters
23 %\usepackage{color}
24 \usepackage{listings}
25 \usepackage{alltt}
26 \lstset{ %
27 language={},               % choose the language of the code
28 basicstyle=\footnotesize\ttfamily, % the size of the fonts that are used for the code
29 numbers=none,              % where to put the line-numbers
30 numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
31 numberfirstline=true,
32 firstnumber=1,             % first line number in each listing
33 stepnumber=5,              % the step between two line-numbers. If it is 1 each line will be numbered
34 numbersep=10pt,            % how far the line-numbers are from the code
35 backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
36 showspaces=false,          % show spaces adding particular underscores
37 showstringspaces=false,    % underline spaces within strings
38 showtabs=false,            % show tabs within strings adding particular underscores
39 frame=single,              % adds a frame around the code
40 tabsize=2,                 % sets default tabsize to 2 spaces
41 captionpos=b,              % sets the caption-position to bottom
42 breaklines=true,           % sets automatic line breaking
43 breakatwhitespace=false,   % sets if automatic breaks should only happen at whitespace
44 escapeinside={\%*}{*)}     % if you want to add a comment within your code
45 }
46 \usepackage{float}
47     \restylefloat{figure}
48 \usepackage{amsmath}       % Provides \nobreakdash
49 \usepackage{amssymb}       % maths
50 \usepackage{graphicx}      % For pictures
51 \usepackage{epstopdf}      % Autoconvert .eps to .pdf
52     \epstopdfsetup{suffix=-generated} % Mark generaed PDF as such
53 \usepackage[pagewise]{lineno} % line numbers
54     \pagewiselinenumbers
55     \setlength\linenumbersep{3em}
56     \renewcommand\linenumberfont{\normalfont\itshape\tiny} 
57     \nolinenumbers    
58 \usepackage{longtable}     % For multipage tables
59 \usepackage{hhline}        % Single column horizontal lines
60 \usepackage{varioref}      % defines \vref
61 %   \textregistered is the trademark symbol
62 \usepackage[headheight=16pt,paper=letterpaper]{geometry}
63     \setlength{\headheight}{15pt}  % avoids warning from latex
64 \usepackage{needspace}     % For assuring space remaining on a page
65 \usepackage{ifthen}        % For conditional processing
66 \include{dwarfchangebarpatch} % Patch needed for package changebar
67 \usepackage{changepage}    % For odd/even page checks
68 \usepackage[usenames,dvipsnames]{xcolor}
69 \usepackage{lscape}        % For landscape mode (Appendix B)
70 \usepackage{tikz}          % graphics (Name Index (Fig 6.1), Appendix B)
71     \usetikzlibrary{arrows}
72     \usetikzlibrary{arrows.meta}
73     \usetikzlibrary{backgrounds}
74     \usetikzlibrary{calc}
75     \usetikzlibrary{chains}
76     \usetikzlibrary{decorations.pathreplacing}
77     \usetikzlibrary{shapes.geometric}
78     \usetikzlibrary{shapes.multipart}
79     \usetikzlibrary{shapes.symbols}
80 \usepackage{changebar}     % For change bars in margin
81 \ifthenelse{\boolean{isdraft}}{}{\nochangebars} % Use no bars in APPROVED Standard
82 \usepackage{xspace}
83 \usepackage{makeidx}       % For making an index
84 % hyperref must be the last package listed.
85 % The hyperref settings helps hypertext get links right in the 
86 % pdf of the index. 
87 % Also, allcolors lets us generate colored active links inside a pdf.
88 % And breaklinks resolves truncation issues with very long link names.
89 \usepackage[breaklinks,plainpages=false,pdfpagelabels,pagebackref,
90             allcolors=blue!80!black,bookmarksnumbered=true]{hyperref}
91 \makeindex  % This and the makeidx package allow \index to create index entries.
92
93 \newcommand{\dwf}{DWARF Debugging Information Format}
94
95 \newenvironment{myindentpara}[1]%
96   {\begin{list}{}%
97     {\setlength{\leftmargin}{#1}}%
98     \item[]%
99   }
100   {\end{list}}
101
102 \hypersetup{colorlinks=true,
103   %bookmarks=true,
104   pdfauthor={\dwf\ Committee},
105   pdftitle={\dwf\ Version 5}
106 }
107
108 % An environment to create a listing-like (boxed) presentation for 
109 % DWARF examples Use like \begin{nlnlisting}...\end{nlnlisting}. 
110 % Does not do line numbers but does full LaTex processing within its 
111 % scope (unlike \verb).
112 \newsavebox{\savedwf}
113 \newenvironment{dwflisting}
114   {\nolinenumbers\begin{lrbox}{\savedwf}\begin{minipage}{\textwidth}\footnotesize}
115   {\end{minipage}\end{lrbox}\fbox{\usebox{\savedwf}} 
116    \condlinenumbers}
117
118 % Conditionally turn on line numbers
119 \newcommand{\condlinenumbers}{\ifthen{\boolean{uselinenumbers}}{\linenumbers}}
120
121 % An environment that turns off line numbers then conditionally turns
122 % them back on at the end
123 \newenvironment{nolinenumbersenv}
124     {\nolinenumbers}
125     {\par\condlinenumbers}
126
127 % An environment like lstlisting that is wrapped to prevent the
128 % contents of the listing from having line numbers generated by
129 % the lineno package
130 \lstnewenvironment{nlnlisting}    % listing-specific newenvironment command
131     {\nolinenumbers}
132     {\condlinenumbers}
133     
134 % A helper to annotate the parts of a multipage figure
135 \newcommand{\figurepart}[2]{\raggedleft{\textit{\tiny{part #1 of #2}}}}
136
137 % Define a simple hyper-reference to a given URL
138 \newcommand{\hrefself}[1]{\href{#1}{#1}}
139
140 % Generate a page ref.
141 % use like   \refersec{chap:registervalues}
142 %\newcommand{\refersec}[1]{\ref{#1} on page \pageref{#1}}
143 \newcommand{\refersec}[1]{\vref{#1}}  % beware possible rerun loop
144 \newcommand{\referfol}[1]{\ref{#1} following}
145
146 % Generate a live link in the document that gets indexed as well
147 % Use like \livelink{chap:DWOPdup}{DW\_OP\_dup}
148 \newcommand{\livelink}[2]{\hyperlink{#1}{#2}\index{#2}}
149 % use when the index is different from the text and target.
150 \newcommand{\livelinki}[3]{\hyperlink{#1}{#2}\index{#3}}
151 % livetarg is the declaration that is the target of livelinks.
152 \newcommand{\livetarg}[2]{\hypertarget{#1}{#2}\index{#2}}
153 % When we want the index entry to look different from the name.
154 \newcommand{\livetargi}[3]{\hypertarget{#1}{#2}\index{#3}}
155
156 \newcommand{\thirtytwobitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{32-bit DWARF format}}
157 \newcommand{\sixtyfourbitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{64-bit DWARF format}}
158
159 \newcommand{\dash}{\nobreakdash-\hspace{0pt}}  % So we handle dashes ok.
160
161 % The following two let us mark a word as 'do not link' or
162 % 'do not index' to indicate the word is used generically
163 % and has been considered so do not index or link it.
164 % There is no significant difference in the two commands, though
165 % \nolink would be more oriented to words such as flag or address
166 % that might be linked (and indexed) in some circumstances.
167 \newcommand{\nolink}[1]{#1}
168 \newcommand{\noindex}[1]{#1}
169
170 % For index entries. The tt-variant of each pair is designed to
171 % allow a word to appear in tt font in the main test and the index
172 % but to collate in the index in its non-tt order. Similarly for
173 % the it-variant using italics font. 
174 % (LaTex normally % sorts all tt words before all non-tt words.)
175 \newcommand{\addtoindex}[1]{#1\index{#1}}
176 \newcommand{\additindex}[1]{\textit{#1}\index{#1@\textit{#1}}}
177 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
178 \newcommand{\addtoindexi}[2]{#1\index{#2}}
179 \newcommand{\additindexi}[2]{\textit{#1}\index{#2@\textit{#2}}}
180 \newcommand{\addttindexi}[2]{\texttt{#1}\index{#2@\texttt{#2}}}
181 \newcommand{\addtoindexx}[1]{\index{#1}}
182 \newcommand{\additindexx}[1]{\index{#1@\textit{#1}}}
183 \newcommand{\addttindexx}[1]{\index{#1@\texttt{#1}}}
184
185 % Quote commands that avoid need for inline UTF-8 in these sources
186 \newcommand{\doublequote}[1]{\textquotedblleft #1\textquotedblright}
187 \newcommand{\singlequote}[1]{\textquoteleft #1\textquoteright}
188
189 % Better naming for the lowest level section header
190 \newcommand{\subsubsubsection}[1]{\paragraph{#1}~\newline}
191 \newcommand{\subsubsubsubsection}[1]{\textbf{#1}.~~}
192
193 % Start new page if less than n lines remain on current page
194 \newcommand{\needlines}[1]{\needspace{#1\baselineskip}}
195
196 % Helper for item lists with bold subject markers
197 \newcommand{\itembf}[1]{\needlines{4} \item \textbf{#1}}
198 \newcommand{\itembfnl}[1]{\itembf{#1} \\}
199
200 % And description lists with normal (not bold) text
201 \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textnormal{#1}}
202 \newcommand{\descriptionlabelnl}[1]{\item[#1] \mbox{}\\}
203
204 % Define an alternate footnote command that creates ragged right text
205 % (using \raggedright in the parameter does not work)
206 \newcommand\footnoteRR[1]{\footnote{\raggedright#1}}
207
208 % Emit an empty page
209 %
210 \newcommand{\emptypage}{
211     \clearpage
212     \vspace*{4in}
213     \begin{nolinenumbers}
214     \begin{center} 
215         \textit{(empty page)} 
216     \end{center}
217     \end{nolinenumbers}
218     }
219
220 % Define a new column type P that is just like p except
221 % that it uses ragged right (rather than right justification}
222 % within a column  of a tabular environment. (See Goossens,
223 % Mittelback&Samarin, "The LaTex Companion", pp108&114.)
224 \newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
225 \newcolumntype{P}[1]{>{\PBS\raggedright\hspace{0pt}}p{#1}}
226
227 % A simple rule used in simple tables; default length is 2 inches
228 \newcommand{\simplerule}[1][2in]{\rule[4pt]{#1}{0.5pt}}
229
230 % A simple one column table of names; default width is 2 inches
231 \newcommand{\simplenametablerule}{\simplerule[2in]}
232 \newenvironment{simplenametable}[3][2in]
233     {   \begin{table}[ht] \caption{#2} \label{#3}
234         \begin{center}
235         \renewcommand{\simplenametablerule}{\simplerule[#1]}
236         \simplenametablerule \\
237         \begin{tabular*}{#1}{l}
238         }
239     {   \end{tabular*}
240         \vspace{4pt} \\
241         \simplenametablerule \\
242         \end{center}
243         \end{table}
244         }
245
246 % Complement of \isundefined
247 \newcommand{\isdefined}[1]{\not{\isundefined{#1}}}
248
249 % Preferred changebar aliases
250 \newcommand{\bb}{\cbstart}      % Begin (change) bar
251 \newcommand{\eb}{\cbend}        % End (change) bar
252 \newcommand{\bbeb}{\bb\eb}      % Mark deleted word or phrase
253 % Mark deleted paragraph
254 \newcommand{\bbpareb}{\vspace{-0.6\baselineskip}\bb~\eb\vspace{-0.6\baselineskip}} 
255 % Variations for use inside an alltt environment--But don't work!
256 %\newcommand(\bballtt){\end{alltt}\bb\vspace{-0.8\baselineskip}\begin{alltt}}
257 %\newcommand{\eballtt}{\end{alltt}\eb\vspace{-0.8\baselineskip}\begin{alltt}}
258 %\newcommand(\bbeballtt){\end{alltt}\bb\eb\vspace{-0.8\baselineskip}\begin{alltt}}
259
260 % Define commands for all of the DWARF names (DW\_*, .debug_*, a few others)
261 %
262 %\newcommand{\definition}[1]{\textcolor{red!80!black}{#1}}
263 \newcommand{\definition}[1]{\textcolor{red!65!black}{#1}}
264 \newcommand{\definitionx}[1]{\definition{\addtoindex{#1}}}
265 \include{dwarfnamecmds}
266
267 % Define commands for pgf use in the name index figure (Fig 6.1)
268 %
269 \include{pgfcmdsfornameindexfig}
270
271 % --------------------------------
272 % --- Begin the document pages ---
273 % --------------------------------
274 %
275 \begin{document}
276 \frontmatter
277 \thispagestyle{empty}
278
279 \nonzeroparskip
280 \setlength{\parindent}{0pt} 
281 \setlength{\headheight}{6cm}
282 \setlength{\uppermargin}{6cm}
283 \setlength{\topsep}{0pt}
284 \tightlists                                     % less spacing before/after lists
285
286 \begin{center}
287 \LARGE
288 \textbf{\dwf}
289 \\
290 \textbf{Version 5}
291 \\
292 \vspace{1cm}
293 \includegraphics[keepaspectratio=true,scale=1.0]{dwarf-logo}
294 \\
295 \vspace{1cm}
296 \href{http://www.dwarfstd.org}{\dwf}
297 \href{http://www.dwarfstd.org}{Committee}
298 \\
299 \vspace{0.5cm} 
300 \url{http://www.dwarfstd.org}
301 \\
302 \vspace{2cm}
303 {\Large \textbf{\docdate}}
304 \\
305 \ifthenelse{\boolean{isdraft}}{
306         \vspace{2cm}
307         \draftmark}
308         {}
309 \end{center}
310
311 \textmd
312 \normalsize
313 \setlength{\headheight}{15pt}  
314 \pagestyle{plain}
315 %\makeevenhead{plain}{}{}{}
316 %\makeoddhead{plain}{}{}{}
317 %\makeevenfoot{plain}{}{}{}
318 %\makeoddfoot{plain}{}{}{}
319 \nonzeroparskip
320 \setlength{\parindent}{0pt} 
321 \settrims{0.5in}{0.5in}
322 \settypeblocksize{8.2in}{6.0in}
323 %\setlrmarginsandblock{0.6in}{0.6in}{*}
324 %\setheadfoot{15pt}{15pt}
325 %\setheaderspaces {*}{2\onelineskip}{*}
326 \nouppercaseheads
327 \makeevenhead{plain}{}{\rightmark}{}
328 \makeoddhead{plain}{}{\rightmark}{}
329 \makeevenfoot{plain}{\docdate}{\draftmark}{Page \thepage}
330 \makeoddfoot{plain}{\docdate}{\draftmark}{Page \thepage}
331
332 %\openany
333
334 \nonzeroparskip
335 \setlength{\parindent}{0pt} 
336 \flushleft
337 \include{copyright}
338 \include{foreword}
339
340 \newpage
341 ~ % Make the page non-empty...
342 \newpage
343 \tableofcontents
344
345 \clearpage
346 \listoffigures
347
348 \clearpage
349 \listoftables
350
351 \ifthenelse{\boolean{usechangesummary}}
352         {       \emptypage
353                 {% Environment to keep the following header change local
354                 \clearpage
355                 \makeevenhead{plain}{}{Change Summary}{}
356                 \makeoddhead{plain}{}{Change Summary}{}
357                 \include{changesummary}
358                 %\emptypage
359                 }
360         }{\emptypage}
361 %\cleardoublepage
362 \flushleft
363 \raggedbottom
364 \chapterstyle{default}
365
366 \setlength{\parindent}{0pt} 
367
368 \makepagestyle{fragFirstChPage}
369     \makeevenhead{fragFirstChPage}{}{}{}
370     \makeoddhead{fragFirstChPage}{}{}{}
371     \makeoddfoot{fragFirstChPage}{\docdate}{\draftmark}{Page \thepage}
372     \makeevenfoot{fragFirstChPage}{\docdate}{\draftmark}{Page \thepage}
373 \nouppercaseheads
374 \aliaspagestyle{chapter}{fragFirstChPage}
375
376 % ----- Start the main part of the document -----
377 \mainmatter
378 % Define the levels of sectionality that are numbered.
379 \setcounter{secnumdepth}{5}
380
381 \condlinenumbers\include{introduction}              \emptypage
382 \condlinenumbers\include{generaldescription}        %\emptypage
383 \condlinenumbers\include{programscope}              \emptypage
384 \condlinenumbers\include{dataobject}                \emptypage
385 \condlinenumbers\include{typeentries}               %\emptypage
386 \condlinenumbers\include{otherdebugginginformation} %\emptypage
387 \condlinenumbers\include{datarepresentation}        %\emptypage
388
389 %  The \appendix command toggles us into appendix chapters
390 \appendix
391
392 \condlinenumbers\include{attributesbytag}               %\emptypage
393 \condlinenumbers\include{debugsectionrelationships} \emptypage
394 \condlinenumbers\include{encodingdecoding}          \emptypage
395 \condlinenumbers\include{examples}                  %\emptypage
396 \condlinenumbers\include{compression}               \emptypage
397 \condlinenumbers\include{splitobjects}              \emptypage
398 \condlinenumbers\include{sectionversionnumbers}     \emptypage
399 \nolinenumbers
400 \include{gnulicense}                           \emptypage
401 % Maybe someday the selected glossary concept will be of interest...
402 %\include{selectedglossary}                    %\emptypage
403 \printindex                                    \clearpage
404 \end{document}