Backup of editorial work to date. Not intended to be
[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 9, 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]{\subparagraph{#1}.~}  %% Huh?
160 \newcommand{\subsubsubsubsection}[1]{\textbf{#1}.~~}
161 %\newcommand{\subsubsubsection}         %% Has to be in a style file--ugh...
162 %   {\@startsection{subsubsubsection}{4}{0mm}{-\baselineskip}{\baselineskip}{\normalfont\normalsize\itshap}}
163
164 % Issue \clearpage if less than n lines remain on page
165 \newcommand{\needlines}[1]{\needspace{#1\baselineskip}}
166
167 % Helper for item lists with bold subject markers
168 \newcommand{\itembf}[1]{\needlines{4} \item \textbf{#1}}
169 \newcommand{\itembfnl}[1]{\itembf{#1} \\}
170
171 % And description lists with normal (not bold) text
172 \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textnormal{#1}}
173 \newcommand{\descriptionlabelnl}[1]{\item[#1] \mbox{}\\}
174
175 % Define an alternate footnote command that creates ragged right text
176 % (using \raggedright in the parameter does not work)
177 \newcommand\footnoteRR[1]{\footnote{\raggedright#1}}
178
179 % Emit an empty page
180 %
181 \newcommand{\emptypage}{
182     \clearpage
183     \vspace*{4in}
184     \begin{nolinenumbers}
185     \begin{center} 
186         \textit{(empty page)} 
187     \end{center}
188     \end{nolinenumbers}
189     }
190
191 % Define a new column type P that is just like p except
192 % that it uses ragged right (rather than right justification}
193 % within a column  of a tabular environment. (See Goossens,
194 % Mittelback&Samarin, "The LaTex Companion", pp108&114.)
195 \newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
196 \newcolumntype{P}[1]{>{\PBS\raggedright\hspace{0pt}}p{#1}}
197
198 % A simple rule used in simple tables; default length is 2 inches
199 \newcommand{\simplerule}[1][2in]{\rule[4pt]{#1}{0.5pt}}
200
201 % A simple one column table of names; default width is 2 inches
202 \newcommand{\simplenametablerule}{\simplerule[2in]}
203 \newenvironment{simplenametable}[3][2in]
204     {   \begin{table}[h] \caption{#2} \label{#3}
205         \begin{center}
206         \renewcommand{\simplenametablerule}{\simplerule[#1]}
207         \simplenametablerule \\
208         \begin{tabular*}{#1}{l}
209         }
210     {   \end{tabular*}
211         \vspace{4pt} \\
212         \simplenametablerule \\
213         \end{center}
214         \end{table}
215         }
216
217 % Complement of \isundefined
218 \newcommand{\isdefined}[1]{\not{\isundefined{#1}}}
219
220 \newcommand{\uselinenos}{\ifthen{\boolean{uselinenos}}{\linenumbers*}}
221
222 % Preferred changebar asliases
223 \newcommand{\bb}{\cbstart}      % Begin (change) bar
224 \newcommand{\eb}{\cbend}        % End (change) bar
225 \newcommand{\bbeb}{\bb\eb}      % Mark deleted word or phrase
226 \newcommand{\bbpareb}{\vspace{-0.6\baselineskip}\bb~\eb\vspace{-0.6\baselineskip}} % Mark deleted paragraph
227
228 % Define commands for all of the DWARF names (DW\_*, .debug_*, a few others)
229 %
230 \newcommand{\definition}[1]{\textcolor{red!80!black}{#1}}
231 \newcommand{\definitionx}[1]{\definition{\addtoindex{#1}}}
232 \include{dwarfnamecmds}
233
234 % Define commands for pgf use in the name index figure (Fig 6.1)
235 %
236 \include{pgfcmdsfornameindexfig}
237
238 % --------------------------------
239 % --- Begin the document pages ---
240 % --------------------------------
241 %
242 \begin{document}
243 \frontmatter
244 \thispagestyle{empty}
245
246 \nonzeroparskip
247 \setlength{\parindent}{0pt} 
248 \setlength{\headheight}{6cm}
249 \setlength{\uppermargin}{6cm}
250 \setlength{\topsep}{0pt}
251 \tightlists                                     % less spacing before/after lists
252
253 \begin{center}
254 \LARGE
255 \textbf{\dwf}
256 \\
257 \textbf{Version 5}
258 \\
259 \vspace{1cm}
260 \includegraphics[keepaspectratio=true,scale=1.0]{dwarf-logo}
261 \\
262 \vspace{1cm}
263 \href{http://www.dwarfstd.org}{\dwf}
264 \href{http://www.dwarfstd.org}{Committee}
265 \\
266 \vspace{0.5cm} 
267 \url{http://www.dwarfstd.org}
268 \\
269 \vspace{2cm}
270 \bb
271 {\Large \textbf{\docdate}}
272 \eb
273 \\
274 \ifthenelse{\boolean{isdraft}}{
275         \vspace{2cm}
276         \draftmark}
277         {}
278 \end{center}
279
280 \textmd
281 \normalsize
282 \setlength{\headheight}{15pt}  
283 \pagestyle{plain}
284 %\makeevenhead{plain}{}{}{}
285 %\makeoddhead{plain}{}{}{}
286 %\makeevenfoot{plain}{}{}{}
287 %\makeoddfoot{plain}{}{}{}
288 \nonzeroparskip
289 \setlength{\parindent}{0pt} 
290 \settrims{0.5in}{0.5in}
291 \settypeblocksize{8.2in}{6.0in}
292 %\setlrmarginsandblock{0.6in}{0.6in}{*}
293 %\setheadfoot{15pt}{15pt}
294 %\setheaderspaces {*}{2\onelineskip}{*}
295 \nouppercaseheads
296 \makeevenhead{plain}{}{\rightmark}{}
297 \makeoddhead{plain}{}{\rightmark}{}
298 \makeevenfoot{plain}{\docdate}{\draftmark}{Page \thepage}
299 \makeoddfoot{plain}{\docdate}{\draftmark}{Page \thepage}
300
301 %\openany
302
303 \nonzeroparskip
304 \setlength{\parindent}{0pt} 
305 \flushleft
306 \include{copyright}
307 \include{foreword}
308
309 \newpage
310 ~ % Make the page non-empty...
311 \newpage
312 \tableofcontents
313
314 \clearpage
315 \listoffigures
316
317 \clearpage
318 \listoftables
319
320 \ifthenelse{\boolean{isdraft}}
321         {       %\emptypage
322                 {% Environment to keep the following header change local
323                 \clearpage
324                 \makeevenhead{plain}{}{Change Summary}{}
325                 \makeoddhead{plain}{}{Change Summary}{}
326                 \include{changesummary}
327                 %\emptypage
328                 }
329         }{}
330 %\cleardoublepage
331 \flushleft
332 \raggedbottom
333 \chapterstyle{default}
334
335 \setlength{\parindent}{0pt} 
336
337 \makepagestyle{fragFirstChPage}
338     \makeevenhead{fragFirstChPage}{}{}{}
339     \makeoddhead{fragFirstChPage}{}{}{}
340     \makeoddfoot{fragFirstChPage}{\docdate}{\draftmark}{Page \thepage}
341     \makeevenfoot{fragFirstChPage}{\docdate}{\draftmark}{Page \thepage}
342 \nouppercaseheads
343 \aliaspagestyle{chapter}{fragFirstChPage}
344
345 % ----- Start the main part of the document -----
346 \mainmatter
347 % Define the levels of sectionality that are numbered.
348 \setcounter{secnumdepth}{5}
349
350 \uselinenos\include{introduction}              \emptypage
351 \uselinenos\include{generaldescription}        \emptypage
352 \uselinenos\include{programscope}              %\emptypage
353 \uselinenos\include{dataobject}                \emptypage
354 \uselinenos\include{typeentries}               \emptypage
355 \uselinenos\include{otherdebugginginformation} \emptypage
356 \uselinenos\include{datarepresentation}        %\emptypage
357
358 %  The \appendix command toggles us into appendix chapters
359 \appendix
360
361 \uselinenos\include{attributesbytag}           %\emptypage
362 \uselinenos\include{debugsectionrelationships} \emptypage
363 \uselinenos\include{encodingdecoding}          \emptypage
364 \uselinenos\include{examples}                  %\emptypage
365 \uselinenos\include{compression}               \emptypage
366 \uselinenos\include{splitobjects}              \emptypage
367 \uselinenos\include{sectionversionnumbers}     \emptypage
368 \nolinenumbers
369 \include{gnulicense}                           \emptypage
370
371 % Maybe someday the selected glossary concept will be of interest...
372 %\include{selectedglossary}             %\emptypage
373
374 \printindex
375
376 \end{document}