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