Introduce \newdwfnamecommands command that defines multiple
[dwarf-doc.git] / dwarf5 / latexdoc / dwarfnamecmds.tex
index 569d6b6..1105dab 100644 (file)
 % Definitions for each of the DWARF names
-% These eliminate the need to use escapes for the underscores and
+% These eliminate the need to use escapes for the underscores or
 % add entries for indexing
 %
 
-% A command to define a pair of name commands
-%
-%\newcommand{\newnamecommands}[2]{
-%      \newcommand{\#1}   {\addtoindex{#2}}
-%      \newcommand{\#1 LL}{\livelink{chap:#1}{#2}}
-%      }
+% A command to define multiple helpful DWARF name commands
+%
+\newcommand{\newdwfnamecommands}[2]{
+       \expandafter\def\csname #1LINK\endcsname{\index{#2}\hyperlink{chap:#1}{#2}}
+       \expandafter\def\csname #1TARG\endcsname{\index{#2}\hypertarget{chap:#1}{#2}}
+       \expandafter\def\csname #1INDX\endcsname{\index{#2}#2}
+       \expandafter\def\csname #1NAME\endcsname{#2}
+       % The normal, most common use in running text...
+       \expandafter\def\csname #1\endcsname{\csname #1LINK\endcsname}
+       }
 
 % DW_AT
 %
-\newcommand{\DWATbitsize}  {\addtoindex                {DW\_AT\_bit\_size}}
-\newcommand{\DWATbitsizeLL}{\livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}}
-\newcommand{\DWATbytesize}  {\addtoindex                 {DW\_AT\_byte\_size}}
-\newcommand{\DWATbytesizeLL}{\livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}}
-\newcommand{\DWATbytestride}  {\addtoindex                   {DW\_AT\_byte\_stride}}
-\newcommand{\DWATbytestrideLL}{\livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}}
-\newcommand{\DWATdatalocation}  {\addtoindex                     {DW\_AT\_data\_location}}
-\newcommand{\DWATdatalocationLL}{\livelink{chap:DWATdatalocation}{DW\_AT\_data\_location}}
-\newcommand{\DWATlocation}  {\addtoindex                 {DW\_AT\_location}}
-\newcommand{\DWATlocationLL}{\livelink{chap:DWATlocation}{DW\_AT\_location}}
-\newcommand{\DWATlowerbound}  {\addtoindex                   {DW\_AT\_lower\_bound}}
-\newcommand{\DWATlowerboundLL}{\livelink{chap:DWATlowerbound}{DW\_AT\_lower\_bound}}
-\newcommand{\DWATmacroinfo}  {\addtoindex                  {DW\_AT\_macro\_info}}
-\newcommand{\DWATmacroinfoLL}{\livelink{chap:DWATmacroinfo}{DW\_AT\_macro\_info}}
-\newcommand{\DWATname}  {\addtoindex             {DW\_AT\_name}}
-\newcommand{\DWATnameLL}{\livelink{chap:DWATname}{DW\_AT\_name}}
-\newcommand{\DWATordering}  {\addtoindex                 {DW\_AT\_ordering}}
-\newcommand{\DWATorderingLL}{\livelink{chap:DWATordering}{DW\_AT\_ordering}}
-\newcommand{\DWATranges}  {\addtoindex               {DW\_AT\_ranges}}
-\newcommand{\DWATrangesLL}{\livelink{chap:DWATranges}{DW\_AT\_ranges}}
-\newcommand{\DWATrank}{\addtoindex               {DW\_AT\_rank}}
-\newcommand{\DWATrankLL}{\livelink{chap:DWATrank}{DW\_AT\_rank}}
-\newcommand{\DWATsibling}  {\addtoindexx               {DW\_AT\_sibling}}
-\newcommand{\DWATsiblingLL}{\livelink{chap:DWATsibling}{DW\_AT\_sibling}}
-\newcommand{\DWATstmtlist}  {\addtoindex                 {DW\_AT\_stmt\_list}}
-\newcommand{\DWATstmtlistLL}{\livelink{chap:DWATstmtlist}{DW\_AT\_stmt\_list}}
-\newcommand{\DWATstringlength}  {\addtoindex                     {DW\_AT\_string\_length}}
-\newcommand{\DWATstringlengthLL}{\livelink{chap:DWATstringlength}{DW\_AT\_string\_length}}
-\newcommand{\DWATstringlengthbitsize}  {\addtoindex                            {DW\_AT\_string\_length\_bit\_size}}
-\newcommand{\DWATstringlengthbitsizeLL}{\livelink{chap:DWATstringlengthbitsize}{DW\_AT\_string\_length\_bit\_size}}
-\newcommand{\DWATstringlengthbytesize}  {\addtoindex                             {DW\_AT\_string\_length\_byte\_size}}
-\newcommand{\DWATstringlengthbytesizeLL}{\livelink{chap:DWATstringlengthbytesize}{DW\_AT\_string\_length\_byte\_size}}
-\newcommand{\DWATtype}  {\addtoindex             {DW\_AT\_type}}
-\newcommand{\DWATtypeLL}{\livelink{chap:DWATtype}{DW\_AT\_type}}
-\newcommand{\DWATupperbound}  {\addtoindex                   {DW\_AT\_upper\_bound}}
-\newcommand{\DWATupperboundLL}{\livelink{chap:DWATupperbound}{DW\_AT\_upper\_bound}}
+\newdwfnamecommands{DWATbitsize}{DW\_AT\_bit\_size}
+\newdwfnamecommands{DWATbytesize}{DW\_AT\_byte\_size}
+\newdwfnamecommands{DWATbytestride}{DW\_AT\_byte\_stride}
+\newdwfnamecommands{DWATdatalocation}{DW\_AT\_data\_location}
+\newdwfnamecommands{DWATlocation}{DW\_AT\_location}
+\newdwfnamecommands{DWATlowerbound}{DW\_AT\_lower\_bound}
+\newdwfnamecommands{DWATmacroinfo}{DW\_AT\_macro\_info}
+\newdwfnamecommands{DWATname}{DW\_AT\_name}
+\newdwfnamecommands{DWATordering}{DW\_AT\_ordering}
+\newdwfnamecommands{DWATranges}{DW\_AT\_ranges}
+\newdwfnamecommands{DWATrank}{DW\_AT\_rank}
+\newdwfnamecommands{DWATsibling}{DW\_AT\_sibling}
+\newdwfnamecommands{DWATstmtlist}{DW\_AT\_stmt\_list}
+\newdwfnamecommands{DWATstringlength}{DW\_AT\_string\_length}
+\newdwfnamecommands{DWATstringlengthbitsize}{DW\_AT\_string\_length\_bit\_size}
+\newdwfnamecommands{DWATstringlengthbytesize}{DW\_AT\_string\_length\_byte\_size}
+\newdwfnamecommands{DWATtype}{DW\_AT\_type}
+\newdwfnamecommands{DWATupperbound}{DW\_AT\_upper\_bound}
 %
 % DW_FORM
 %
-\newcommand{\DWFORMrefsigeight}{\addtoindex{DW\_FORM\_ref\_sig8}}
-\newcommand{\DWFORMstrp}[1][]{\addtoindex{DW\_FORM\_strp}}
+\newdwfnamecommands{DWFORMrefsigeight}{DW\_FORM\_ref\_sig8}
+\newdwfnamecommands{DWFORMstrp}{DW\_FORM\_strp}
 %
 % DW_LANG
 %
-\newcommand{\DWLANGGo}{\addtoindex{DW\_LANG\_Go}}
-\newcommand{\DWLANGHaskell}{\addtoindex{DW\_LANG\_Haskell}}
-\newcommand{\DWLANGModulaThree}{\addtoindex{DW\_LANG\_Modula3}}
-\newcommand{\DWLANGOpenCL}{\addtoindex{DW\_LANG\_OpenCL}}
+\newdwfnamecommands{DWLANGGo}{DW\_LANG\_Go}
+\newdwfnamecommands{DWLANGHaskell}{DW\_LANG\_Haskell}
+\newdwfnamecommands{DWLANGModulaThree}{DW\_LANG\_Modula3}
+\newdwfnamecommands{DWLANGOpenCL}{DW\_LANG\_OpenCL}
 %
 % DW_OP
 %
-\newcommand{\DWOPcallref}  {\addtoindex                {DW\_OP\_call\_ref}}
-\newcommand{\DWOPcallrefLL}{\livelink{chap:DWOPcallref}{DW\_OP\_call\_ref}}
-\newcommand{\DWOPconst}  {\addtoindex              {DW\_OP\_const}}
-\newcommand{\DWOPconstLL}{\livelink{chap:DWOPconst}{DW\_OP\_const}}
-\newcommand{\DWOPderef}  {\addtoindex              {DW\_OP\_deref}}
-\newcommand{\DWOPderefLL}{\livelink{chap:DWOPderef}{DW\_OP\_deref}}
-\newcommand{\DWOPformtlsaddress}  {\addtoindex                       {DW\_OP\_form\_tls\_address}}
-\newcommand{\DWOPformtlsaddressLL}{\livelink{chap:DWOPformtlsaddress}{DW\_OP\_form\_tls\_address}}
-\newcommand{\DWOPlit}  {\addtoindex            {DW\_OP\_lit}}
-\newcommand{\DWOPlitLL}{\livelink{chap:DWOPlit}{DW\_OP\_lit}}
-\newcommand{\DWOPmult}  {\addtoindex             {DW\_OP\_mult}}
-\newcommand{\DWOPmultLL}{\livelink{chap:DWOPmult}{DW\_OP\_mult}}
-\newcommand{\DWOPplus}  {\addtoindex             {DW\_OP\_plus}}
-\newcommand{\DWOPplusLL}{\livelink{chap:DWOPplus}{DW\_OP\_plus}}
-\newcommand{\DWOPpushobjectaddress}  {\addtoindex                          {DW\_OP\_push\_object\_address}}
-\newcommand{\DWOPpushobjectaddressLL}{\livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address}}
+\newdwfnamecommands{DWOPcallref}{DW\_OP\_call\_ref}
+\newdwfnamecommands{DWOPconst}{DW\_OP\_const}
+\newdwfnamecommands{DWOPderef}{DW\_OP\_deref}
+\newdwfnamecommands{DWOPformtlsaddress}{DW\_OP\_form\_tls\_address}
+\newdwfnamecommands{DWOPlit}{DW\_OP\_lit}
+\newdwfnamecommands{DWOPmult}{DW\_OP\_mult}
+\newdwfnamecommands{DWOPplus}{DW\_OP\_plus}
+\newdwfnamecommands{DWOPpushobjectaddress}{DW\_OP\_push\_object\_address}
 %
 % DW_ORD
 %
-\newcommand{\DWORDcolmajor}  {\addtoindex                  {DW\_ORD\_col\_major}}
-\newcommand{\DWORDcolmajorLL}{\livelink{chap:DWORDcolmajor}{DW\_ORD\_col\_major}}
-\newcommand{\DWORDrowmajor}  {\addtoindex                  {DW\_ORD\_row\_major}}
-\newcommand{\DWORDrowmajorLL}{\livelink{chap:DWORDrowmajor}{DW\_ORD\_row\_major}}
+\newdwfnamecommands{DWORDcolmajor}{DW\_ORD\_col\_major}
+\newdwfnamecommands{DWORDrowmajor}{DW\_ORD\_row\_major}
 %
 % DW_TAG
 %
-\newcommand{\DWTAGarraytype}  {\addtoindex                   {DW\_TAG\_array\_type}}
-\newcommand{\DWTAGarraytypeLL}{\livelink{chap:DWTAGarraytype}{DW\_TAG\_array\_type}}
-\newcommand{\DWTAGcoarraytype}  {\addtoindex                     {DW\_TAG\_coarray\_type}}
-\newcommand{\DWTAGcoarraytypeLL}{\livelink{chap:DWTAGcoarraytype}{DW\_TAG\_coarray\_type}}
-\newcommand{\DWTAGgenericsubrange}  {\addtoindex                        {DW\_TAG\_generic\_subrange}}
-\newcommand{\DWTAGgenericsubrangeLL}{\livelink{chap:DWTAGgenericsubtype}{DW\_TAG\_generic\_subrange}}
-\newcommand{\DWTAGmember}  {\addtoindex                {DW\_TAG\_member}}
-\newcommand{\DWTAGmemberLL}{\livelink{chap:DWTAGmember}{DW\_TAG\_member}}
-\newcommand{\DWTAGsubrangetype}  {\addtoindex                      {DW\_TAG\_subrange\_type}}
-\newcommand{\DWTAGsubrangetypeLL}{\livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type}}
-\newcommand{\DWTAGvariable}  {\addtoindex                  {DW\_TAG\_variable}}
-\newcommand{\DWTAGvariableLL}{\livelink{chap:DWTAGvariable}{DW\_TAG\_variable}}
+\newdwfnamecommands{DWTAGarraytype}{DW\_TAG\_array\_type}
+\newdwfnamecommands{DWTAGcoarraytype}{DW\_TAG\_coarray\_type}
+\newdwfnamecommands{DWTAGgenericsubrange}{DW\_TAG\_generic\_subrange}
+\newdwfnamecommands{DWTAGmember}{DW\_TAG\_member}
+\newdwfnamecommands{DWTAGsubrangetype}{DW\_TAG\_subrange\_type}
+\newdwfnamecommands{DWTAGvariable}{DW\_TAG\_variable}
 %
 % .debug, et al
 %