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