So far, we have shown that HyperCode displays functions, data types, and variables with links placed according to a simple paradigm: uses are linked to definitions, definitions to backtrace lists, and elements of backtrace lists back to uses. Preprocessor macros, however, require more sophisticated treatment, and in some circumstances complicate the treatment of functions, data types, and variables.
Macro definitions are handled much as function, data type, or variable definitions; HyperCode presents each macro definition with a link to a backtrace list of invocation sites, each element of which is linked in turn to the invocation site it describes.
However, macro uses are handled substantially differently than
function, data type, or variable uses. Instead of being linked
directly to a definition, each macro invocation in source code is
linked to an expansion site where the macro's expansion is
presented step-by-step (Figure 7). Simple macros may
expand in one step; more complicated ones may expand through multiple
levels of nesting as in Figure 7. The expansion site
includes a links to the macro's definition. Any functions, data
types, or variables exposed by the expansion of a macro are linked as
if they had appeared in the code. For example, in Figure 8, the macro
GENERIC_PTR, exposed by the expansion of the macro NULL_PTR, is linked to its definition as well as being expanded as
part of the expansion of NULL_PTR.
Two important programmer advantages result from HyperCode macro
expansion sites. First, as with functions, types, and variables, the
basic set of links explicitly represent the network of relationships
between preprocessor macros, making additions and alterations
substantially easier to implement safely. Second, the exact expansion
of a macro at a particular site is explicitly drawn out. A user need
not search through each and every include file for the last applicable
definition of a particular macro in order to discover its definition;
nor need the user be fluent in ANSI specifications to correctly
predict how a macro will expand.
When a macro expands to expose a function, variable, or data type use
or definition, links that would have pointed to that site had it
occurred explicitly in the code instead point to the macro invocation
in the code; this mechanism makes it clear where in the context of the
code the mention is made, and the mention itself can be exposed by
following the link to the macro's expansion site.
Next: Implementation Overview
Up: Appearance
Previous: Variable Links