refer.py: New app, close to working. To identify
[dwarf-doc.git] / dwarf5 / tools / testrefer.tex
1 \% Definitions for each of the DWARF names
2 % These eliminate the need to use escapes for the underscores or
3 % add entries for indexing
4 %
5
6 \newcommand{\addtoindex}[1]{#1\index{#1}}
7 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
8 \newcommand{\refersec}[1]{\vref{#1}}  % beware possible rerun loop
9 \newcommand{\referfol}[1]{\ref{#1} following}
10
11 % Generate a live link in the document
12 % use like \livelink{chap:DWOPdup}{DW\_OP\_dup}
13 \newcommand{\livelink}[2]{\hyperlink{#1}{#2}\index{#2}}
14 % use when the index is different from the text and target.
15 \newcommand{\livelinki}[3]{\hyperlink{#1}{#2}\index{#3}}
16 % livetarg is the declaration this is the target of livelinks.
17 % FIXME: we might want livetarg and livetargi  #2 to be \textbf{#2}
18 \newcommand{\livetarg}[2]{\hypertarget{#1}{#2}\index{#2}}
19 % When we want the index entry to look different from the name.
20 \newcommand{\livetargi}[3]{\hypertarget{#1}{#2}\index{#3}}
21
22 \newcommand{\thirtytwobitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{32-bit DWARF format}}
23 \newcommand{\sixtyfourbitdwarfformat}[1][]{\livelink{datarep:xxbitdwffmt}{64-bit DWARF format}}
24
25 % For index entries. The tt-variant of each pair is designed to
26 % allow a word to appear in tt font in the main test and the index
27 % but to collate in the index in its non-tt order. (LaTex normally
28 % sorts all tt words before all non-tt words.)
29 \newcommand{\addtoindex}[1]{#1\index{#1}}
30 \newcommand{\addttindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}}
31 \newcommand{\addtoindexi}[2]{#1\index{#2}}
32 \newcommand{\addttindexi}[2]{\texttt{#1}\index{#2@\texttt{#2}}}
33 \newcommand{\addtoindexx}[1]{\index{#1}}
34 \newcommand{\addttindexx}[1]{\index{#1@\texttt{#1}}}
35
36
37
38
39
40 % A command to define multiple helpful DWARF name commands
41 %
42 \newcommand{\newdwfnamecommands}[2]{
43         \expandafter\def\csname #1LINK\endcsname{\index{#2}\hyperlink{chap:#1}{#2}}
44         \expandafter\def\csname #1TARG\endcsname{\index{#2}\hypertarget{chap:#1}{#2}}
45         \expandafter\def\csname #1INDX\endcsname{\index{#2}#2}
46         \expandafter\def\csname #1MARK\endcsname{\hypertarget{chap:#1}{}\index{#2}}     
47         \expandafter\def\csname #1NAME\endcsname{#2}
48         % The normal, most common use in running text...
49         \expandafter\def\csname #1\endcsname{\csname #1LINK\endcsname}
50         }
51
52
53 % DW_ACCESS
54 %
55 \newdwfnamecommands{DWACCESSprivate}{DW\_ACCESS\_private}
56 \newdwfnamecommands{DWACCESSprotected}{DW\_ACCESS\_protected}
57 \newdwfnamecommands{DWACCESSpublic}{DW\_ACCESS\_public}
58 %
59 % DW_ADDR
60 %
61 \newdwfnamecommands{DWADDRnone}{DW\_ADDR\_none}
62 %
63 % DW_AT
64 %
65 \newdwfnamecommands{DWATabstractorigin}{DW\_AT\_abstract\_origin}
66 \newdwfnamecommands{DWATaccessibility}{DW\_AT\_accessibility}
67 \newdwfnamecommands{DWATaddrbase}{DW\_AT\_addr\_base}
68 \newdwfnamecommands{DWATaddressclass}{DW\_AT\_address\_class}
69 \newdwfnamecommands{DWATallocated}{DW\_AT\_allocated}
70 \newdwfnamecommands{DWATartificial}{DW\_AT\_artificial}
71 \newdwfnamecommands{DWATassociated}{DW\_AT\_associated}
72 %
73 \newdwfnamecommands{DWATbasetypes}{DW\_AT\_base\_types}
74 \newdwfnamecommands{DWATbinaryscale}{DW\_AT\_binary\_scale}
75 \newdwfnamecommands{DWATbitoffset}{DW\_AT\_bit\_offset}
76 \newdwfnamecommands{DWATbitsize}{DW\_AT\_bit\_size}
77 \newdwfnamecommands{DWATbitstride}{DW\_AT\_bit\_stride}
78 \newdwfnamecommands{DWATbyteoffset}{DW\_AT\_byte\_offset}
79 \newdwfnamecommands{DWATbytesize}{DW\_AT\_byte\_size}
80 \newdwfnamecommands{DWATbytestride}{DW\_AT\_byte\_stride}
81 %
82 \newdwfnamecommands{DWATcallcolumn}{DW\_AT\_call\_column}
83 \newdwfnamecommands{DWATcallfile}{DW\_AT\_call\_file}
84 \newdwfnamecommands{DWATcallline}{DW\_AT\_call\_line}
85 \newdwfnamecommands{DWATcallingconvention}{DW\_AT\_calling\_convention}
86 \newdwfnamecommands{DWATcommonreference}{DW\_AT\_common\_reference}
87 \newdwfnamecommands{DWATcompdir}{DW\_AT\_comp\_dir}
88 \newdwfnamecommands{DWATconstexpr}{DW\_AT\_const\_expr}
89 \newdwfnamecommands{DWATconstvalue}{DW\_AT\_const\_value}
90 \newdwfnamecommands{DWATcontainingtype}{DW\_AT\_containing\_type}
91 \newdwfnamecommands{DWATcount}{DW\_AT\_count}
92 %
93 \newdwfnamecommands{DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
94 \newdwfnamecommands{DWATdatalocation}{DW\_AT\_data\_location}
95 \newdwfnamecommands{DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
96 \newdwfnamecommands{DWATdecimalscale}{DW\_AT\_decimal\_scale}
97         \newcommand{\DWOPbregtwo}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg2}}            % Link, don't index...
98         \newcommand{\DWOPbregthree}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg3}}          %
99         \newcommand{\DWOPbregfour}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg4}}           %
100         \newcommand{\DWOPbregfive}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg5}}           %
101         \newcommand{\DWOPbregeleven}{\hyperlink{chap:DWOPbregn}{DW\_OP\_breg11}}        %
102 \newdwfnamecommands{DWOPbregx}{DW\_OP\_bregx}
103 \newdwfnamecommands{DWOPcalltwo}{DW\_OP\_call2}
104 \newdwfnamecommands{DWOPcallfour}{DW\_OP\_call4}
105 %
106 %%%%%%%%%%%%%%%
107 %
108 % .debug_*, .debug_*.dwo, et al
109 %
110 \newcommand{\dotdebugabbrev}{\addtoindex{\texttt{.debug\_abbrev}}}
111 \newcommand{\dotdebugaddr}{\addtoindex{\texttt{.debug\_addr}}}
112 \newcommand{\dotdebugaranges}{\addtoindex{\texttt{.debug\_aranges}}}
113 \newcommand{\dotdebugframe}{\addtoindex{\texttt{.debug\_frame}}}
114 %
115 \newcommand{\dotdata}{\addtoindex{\texttt{.data}}}
116 \newcommand{\dottext}{\addtoindex{\texttt{.text}}}
117 %
118 % Current section version numbers
119 %
120 \newcommand{\versiondotdebugabbrev}  {5}
121 \newcommand{\versiondotdebugaddr}    {5}
122 \newcommand{\versiondotdebugstr}     {5}
123 \newcommand{\versiondotdebugstroffsets}{5}
124 \newcommand{\versiondotdebugtypes}   {\versiondotdebuginfo}
125 %
126 % DWARF Standard Versions
127 %
128 \newcommand{\DWARFVersionI}   {\addtoindex{DWARF Version 1}}
129 \newcommand{\DWARFVersionII}  {\addtoindex{DWARF Version 2}}
130 %
131 \newcommand{\MDfive}{\livelink{def:MDfive}{MD5}}
132
133
134 \DWACCESSpublic&0x01  \\
135 \DWACCESSpublicTARG{}     
136 # Following is duplicate def
137 \DWACCESSpublicTARG{}     
138
139 \DWATcountLINK
140 % Following should generate error
141 \DWATcountnodwnamecommand + 3
142
143 % just shows the name. Not a target or even indexed.
144 % Actually an error because we never defined this above.
145 A \DWATnonameNAME{} attribute whose value is a
146
147 \livelinki{datarep:classreference}{reference}{reference class}
148 \livelinki{datarep:classstring}{string}{string class}
149 describe the static \livelink{chap:lexicalblock}{block} structure 
150 \livelink{chap:lexicalblock}{lexical block} that owns it, 
151 class \livelink{chap:classexprloc}{exprloc}  
152 using class \livelink{chap:classloclistptr}{loclistptr}
153 which is a \livelink{chap:classflag}{flag}.
154 \livelink{chap:classflag}{flag}.
155 attribute whose value is a \livelink{chap:classreference}{reference} to
156
157 \livetargi{chap:declarationcoordinates}{}{declaration coordinates}
158 oops \livetarg{chap:classreference}{}
159 buy \livetarg{chap:classexprloc}{}
160 something \livetarg{chap:classflag}{}
161 nice \livetarg{chap:DWATdwoidforunit}{}
162 today \livetarg{chap:DWATdwoidforunit}{}
163
164 \label{mylabone}
165 \label{mylabtwo}
166 \label{mylabdup}
167 \label{mylabdup}
168 \refersec{mylabone}
169 \refersec{danglingref}
170
171 % defines label
172 \begin{simplenametable}[1.9in]{Accessibility codes}{tab:goodlabel}
173 % No label
174 \begin{simplenametable}[1.9in]
175 % no label here, not reported
176 \begin{foo}[1.9in]{Accessibility codes}{badlabel}
177 \begin{simplenametable}[1.9in]{Accessibility codes}{chap:unusedlabel}
178 \refersec{tab:goodlabel}