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