MacroHistoryHtml

Writes out a macro history in HTML.

Macros can be: Active - In scope at the end of processing a translation unit (one per identifier). Inactive - Not in scope at the end of processing a translation unit (>=0 per identifier). And: Referenced - Have had some influence over the processing of the translation unit. Not Referenced - No influence over the processing of the translation unit.

Example test:

/* Source         Active?    Refs    ID   */
#define FOO    /*     N        0    FOO_0 */
#undef FOO
#define FOO    /*     N        2    FOO_1 */
FOO
FOO
#undef FOO
#define FOO    /*     Y        1    FOO_2 */
FOO
#define BAR    /*     Y        0    BAR_0 */

Macros with reference counts of zero are not that interesting so they are relegated to a page (<file>_macros_noref.html) that just describes their definition and where they where defined.

Macros _with_ reference counts are presented on a page (<file>_macros_ref.html) with one section per macro. The section has: definition, where defined, [This macro depends on the following macros:], [Macros that depend on this macro:],

These two HTML pages are joined by a <file>_macros.html this lists (and links to) the identifiers in this order: - Active, ref count >0 - Inactive, ref count >0 - Active, ref count =0 - Inactive, ref count =0

Macro HTML IDs

This is identifier + ‘_’ + n For any active macro the value of n is the number of previously defined macros. Current code is like this:

myUndefIdxS, isDefined = myMacroMap[aMacroName]
# Write the undefined ones
for anIndex in myUndefIdxS:
    myMacro = theEnv.getUndefMacro(anIndex)
    startLetter = _writeTrMacro(theS, theHtmlPath, myMacro,
                               anIndex, startLetter, retVal) 
# Now the defined one
if isDefined:
    myMacro = theEnv.macro(aMacroName)
    startLetter = _writeTrMacro(theS, theHtmlPath, myMacro,
                               len(myUndefIdxS), startLetter, retVal) 
cpip.MacroHistoryHtml.processMacroHistoryToHtml(theLex, theHtmlPath, theItu, theIndexPath)

Write out the macro history from the PpLexer as HTML. Returns a map of: {identifier : [(fileId, lineNum, href_name), ...], ...} which can be used by src->html generator for providing links to macro pages.

cpip.MacroHistoryHtml.splitLine(theStr, splitLen=60, splitLenHard=80)

Splits a long string into string that is a set of lines with continuation characters.

cpip.MacroHistoryHtml.splitLineToList(sIn, splitLen=60, splitLenHard=80)

Splits a long string into a list of lines. This tries to do it nicely at whitespaces but will force a split if necessary.

Table Of Contents

Previous topic

ItuToHtml

Next topic

TokenCss

This Page