headerDoc2HTML.plIntroductionThe main HeaderDoc tool, This document provides API-level documentation on the tool's internals. For user documentation, see HeaderDoc User Guide. Functions
depthfirstDepth-first tree walk used in determining dependency order. sub depthfirst depthfirst_recRecursive portion of depth-first tree walk used in determining dependency order. sub depthfirst_rec fix_dependency_orderReorders a list of C headers in dependency order. Return ValueReturns the result of a depth-first walk of the dependency graph in the form of a dependency-ordered array. DiscussionThe dependency calculation is fairly straightforward. For
each header, HeaderDoc reads the list of
After creating these child dependencies for every header, the result is a graph of dependencies, with cycles. Finally, the code performs a depth-first walk of the graph (with cycle detection). Because each object is guaranteed to be lower in the graph for at least one path through the graph than any file on which it depends (ignoring circular dependencies), this is sufficient to ensure that any file is processed prior to any file that it includes. Local Variables
generate_depth_levelsLays out dependencies in a tree structure. getDoxyTagFilesSearch helper for Doxygen-style tag files. sub getDoxyTagFiles DiscussionDuring processing, each source file results in a corresponding Doxygen-style tag file (if the -x flag is specified). This search helper is used in tracking those files down for merging at the end of processing. getHeadersSearch helper for header files. sub getHeaders DiscussionThis is used for comparing names against the list of valid file extensions to see if they should be processed by HeaderDoc. in_exclude_listChecks the exclude list for filenames. sub in_exclude_list( $) DiscussionWhen you specify an exclude list (the -e flag), HeaderDoc reads that file for a list of expressions to match. Every time HeaderDoc opens a header file, source file, or other file to process, it checks it against that list by calling this function. mergeClassMerges superclass bits into subclass upon request. sub mergeClass DiscussionThe mergeClass function is used for merging bits of
a superclass into subclasses when the It is also always used for C psuedoclass classes because any pseudo-superclass relationship isn't really a superclass. mergeDoxyTagsMerge doxygen tag files and delete the partial files. sub mergeDoxyTags mkdir_recursiveCreates directories recursively as needed. sub mkdir_recursive DiscussionThis is the Perl equivalent of "mkdir -p" on the command line. newtestCreates a new test for the test framework. sub newtest DiscussionSee HeaderDoc User Guide for info about creating tests. prefilterCommentCheckChecks for comment characters in a line and adjusts an
Parameters
Return ValueReturns the new value for printCPPHashesPrints the CPP hashes for debugging purposes. sub printCPPHashes printVersionInfoCollects version info from HeaderDoc modules and prints. sub printVersionInfo processIncludesGrabs any #include directives. sub processIncludes( $$$) runResolveLinksTestsRuns the resolveLinks test suite. runtestlistRuns multiple tests using the test framework. sub runtestlist DiscussionSee HeaderDoc User Guide for info about running tests. runtestsRuns a test using the test framework. sub runtests DiscussionSee HeaderDoc User Guide for info about running tests. SDumpTest code for dumping notes in dependency tree. sub SDump set_node_depthsSets node depth information in the tree structure as part of the depth-first tree walk code. sub set_node_depths setTOCFormatSets the TOC format value based on its name. sub setTOCFormat DiscussionReturns values via
stripStrips out HeaderDoc comments from a header. sub strip Globals
debuggingStorage for the -d flag. my $debugging = 0; doxytag_outputStorage for the -x flag. my $doxytag_output; doxyTagFilesTemp storage for list of temp files. my @doxyTagFiles; function_list_outputStorage for the -f flag. my $function_list_output; functionGroupThe name of the current function group. my $functionGroup = ""; DiscussionSet by the HeaderDoc::AccessControlStateThe current access control state used and modified by the parser. $HeaderDoc::AccessControlState = ""; DiscussionThis should probably be passed around through arguments, but for now, it is't. HeaderDoc::add_link_requestsDisables link requests in declarations ( $HeaderDoc::add_link_requests = 1; DiscussionBy default, HeaderDoc inserts link requests into the
declarations in HTML output. If you have no interest
in declaration linking, you can turn this off by
passing the HeaderDoc::align_columnsStorage for the $HeaderDoc::align_columns = 1; HeaderDoc::allow_multiDetermines whether to treat commented
$HeaderDoc::allow_multi = 0; DiscussionSet to 1 by default.
Set to 0 if the HeaderDoc::appleRefUsedA hash of all API reference markers for minir API elements emitted so far. %HeaderDoc::appleRefUsed = (); DiscussionUsed to prevent anyAPI reference markers from being emitted when a documentation block that describes a declaration with multiple names gets emitted a second (or subsequent) time. HeaderDoc::auto_availabilityStorage for the $HeaderDoc::auto_availability = 0; DiscussionBy default, HeaderDoc ignores HeaderDoc::availability_defsA hash table mapping availability macros to the text that describes them. %HeaderDoc::availability_defs = (); DiscussionUsed in the block parser to get a human-readable string that describes the availability of the current declaration. HeaderDoc::availability_has_argsA hash table mapping availability macros to whether or not the macro declaration takes a parenthesized argument list. %HeaderDoc::availability_has_args = (); DiscussionUsed in the block parser to determine whether to strip off the subsequent parenthetical code or not. HeaderDoc::c_compilerThe default C compiler. $HeaderDoc::c_compiler = "/usr/bin/gcc"; DiscussionBy default, HeaderDoc uses HeaderDoc::ClassAsCompositeStorage for the $HeaderDoc::ClassAsComposite = 0; HeaderDoc::cppArgHashListA list of C preprocessor argument hashes for the current header. @HeaderDoc::cppArgHashList = (); DiscussionThis gets reset for each header.
HeaderDoc::cppHashListA list of C preprocessor token hashes for the current header. @HeaderDoc::cppHashList = (); DiscussionThis gets reset for each header. For more
info, see the documentation for
HeaderDoc::CurLineThe current line number being parsed. $HeaderDoc::CurLine = 0; DiscussionUsed as an out-of-band way to get this information into the parse tree. Should ideally be an argument when each parse tree node is being created, but that isn't nearly as easy as it sounds. HeaderDoc::currentClassUsed to set the owning class when processing embedded API symbols. $HeaderDoc::currentClass = undef; HeaderDoc::custom_tagsA reference to a hash of non-standard tags to allow. $HeaderDoc::custom_tags = undef; DiscussionNormally, HeaderDoc converts unknown tags to text.
You can add custom tags to the list of allowed tags
by listing them in the HeaderDoc::datefmtThe date format used for date stamps. $HeaderDoc::datefmt = $config{ "dateFormat" }; DiscussionValue comes from the HeaderDoc::debugAllocationsTurns on debug output when objects are allocated and released. $HeaderDoc::debugAllocations = 0; HeaderDoc::debugFileSet to the name of a file to tell HeaderDoc to enable debugging when processing that file. $HeaderDoc::debugFile = ""; DiscussionOnly active if HeaderDoc::defaultHeaderCommentThe default comment in the right side if a header or class lacks a discussion. $HeaderDoc::defaultHeaderComment = "Use the links in the table of contents to the left to access the documentation.<br>\n"; HeaderDoc::document_internalEnable internal documentation. $HeaderDoc::document_internal = 0; DiscussionStorage for the HeaderDoc::dumb_as_dirtDeprecated. $HeaderDoc::dumb_as_dirt = 1; DiscussionStorage for the HeaderDoc::enable_cppStorage for the $HeaderDoc::enable_cpp = 0; HeaderDoc::enable_macro_filterSet if any $HeaderDoc::enable_macro_filter = 1; DiscussionThis enables and disables the C preprocessor filtering portions. HeaderDoc::enable_reverse_matchDetermines whether the macro filter code
should treat the $HeaderDoc::enable_reverse_match = 0; DiscussionHeaderDoc See Also HeaderDoc::enableParanoidWarningsStorage for the $HeaderDoc::enableParanoidWarnings = 0; HeaderDoc::exclude_patternsThe list of filename patterns to exclude when producing documentation. @HeaderDoc::exclude_patterns = (); DiscussionObtained from the file specified by the
HeaderDoc::exitstatusThe exit status. Changed to nonzero whenever an error occurs. $HeaderDoc::exitstatus = 0; HeaderDoc::explicit_toc_formatStorage for the $HeaderDoc::explicit_toc_format = undef; HeaderDoc::externalStyleSheetsStorage for the $HeaderDoc::externalStyleSheets = undef; HeaderDoc::externalTOCStyleSheetsStorage for the $HeaderDoc::externalTOCStyleSheets = undef; HeaderDoc::ExtraAppleWarningsFlags certain XML tags as illegal due to Apple-internal constraints. $HeaderDoc::ExtraAppleWarnings = 0; HeaderDoc::fileDebugSet to 1 if you need to enable lots of debugging for a single file. $HeaderDoc::fileDebug = 0; DiscussionMost of the time, when debugging, you can get by with processing a single file. When debugging subtle C preprocessing bugs or other subtle misbehavior, however, it is occasionally necessary to process a lot of files to reproduce the bug. This flag allows you to leave debugging off until you get to a particular file, then turn it on temporarily for the duration of that file. This flag must be used in conjunction with
HeaderDoc::filter_macro_definition_stateA hash of macro definition states passed in on the command line that are interpreted by the macro filter engine. %HeaderDoc::filter_macro_definition_state = (); DiscussionLegal values are:
This variable is used only if HeaderDoc::filter_macro_definition_valueA hash of macro values passed in on the command line that are interpreted by the macro filter engine. %HeaderDoc::filter_macro_definition_value = (); DiscussionThis hash contains the actual numerical values passed in on the command line. If no value is specified, the value defaults to 1. This variable is used only if For explicitly undefined values ( HeaderDoc::flagDashCStorage for the $HeaderDoc::flagDashC = undef; DiscussionThis flag is only supported when combined with the older
TOC formats ( HeaderDoc::flagDashFStorage for the $HeaderDoc::flagDashF = undef; HeaderDoc::force_parameter_taggingEnables strict parameter taggint warnings ( $HeaderDoc::force_parameter_tagging = 0; HeaderDoc::FreezeThaw_availableIndicates whether the FreezeThaw Perl module is available. $HeaderDoc::FreezeThaw_available = 0; DiscussionNot all Mac OS X versions have this. It's in 10.5 and later. For backwards compatibility, this code does a check here and doesn't allow the test code (-T flag) to run if it isn't available. HeaderDoc::globalGroupThe name of the current group. $HeaderDoc::globalGroup = ""; DiscussionSet by the HeaderDoc::grouprightSorts content in the right side (content) pane by group. $HeaderDoc::groupright = 0; HeaderDoc::HeaderFileCPPArgHashHashHash of argument lists for C preprocessor macros. %HeaderDoc::HeaderFileCPPArgHashHash = (); DiscussionThis hash is a copy of one of the C preprocessor internal hashes. It is returned to the top-level code by a call to getAndClearCPPHash(), and is then merged with the hashes from any headers that the current header includes. See HeaderDoc::HeaderFileCPPHashHashHash of C preprocessor token hashes for files processed to date. %HeaderDoc::HeaderFileCPPHashHash = (); DiscussionThis hash is a copy of one of the C preprocessor internal hashes. It is returned to the top-level code by a call to getAndClearCPPHash(), and is then merged with the hashes from any headers that the current header includes. In addition to storing the values for future merges, this copy of the hash is used to determine whether a header file has been processed already for the purposes of determining whether or not to merge in C preprocessor macro definitions. See HeaderDoc::headerObjectGlobal header object for the header currently being parsed. $HeaderDoc::headerObject = undef; DiscussionThis should eventually go away. HeaderDoc::hidetokensIndicates that all token objects should be marked hidden. $HeaderDoc::hidetokens = 0; DiscussionThe block parser uses this variable as an out-of-band way to pass the "hide node" flag data to the parse tree package. Ideally, this should eventuallly go away and should be replaced by changes to every place where a new node gets created, but that isn't nearly as easy as it sounds. HeaderDoc::idl_languageThe API reference language for IDL file content. $HeaderDoc::idl_language = "idl"; DiscussionAn IDL file contains an interface description in an abstract interface description language (hence the abbreviation). Thus, the actual interfaces could be for any programming language. By default, IDL file API references (apple_ref symbol markers)
are emitted using HeaderDoc::ignore_apiowner_namesStorage for the $HeaderDoc::ignore_apiowner_names = 0; HeaderDoc::ignore_apiuid_errorsSet to true when HeaderDoc should suppress warnings about API reference conficts, object name changes, and so on. $HeaderDoc::ignore_apiuid_errors = 0; DiscussionThis is set to 1 when HeaderDoc is deliberately making a change to an object that would normally trigger a warning. Do not set this indiscriminately, as doing so can mask actual errors in source content that result in incorrect output. HeaderDoc::ignorePrefixesDeprecated. %HeaderDoc::ignorePrefixes = (); DiscussionStorage for an old scheme to ignore junk CPP tokens at the start of line. This holds the value of the ignorePrefixes field in the config file. The currently recommended way to do this is with the C preprocessor on the command line (-D FOO="") or in code. HeaderDoc::IncludeSuperStorage for the $HeaderDoc::IncludeSuper = 1; HeaderDoc::insert_headerStorage for the $HeaderDoc::insert_header = 0; HeaderDoc::interpret_caseDetermines whether the macro filter code
attempts to handle $HeaderDoc::interpret_case = 0; DiscussionHeaderDoc HeaderDoc::introductionNameStorage for the $HeaderDoc::introductionName = "Introduction"; HeaderDoc::langGlobal variable where the language family info for the header currently being parsed is stored. $HeaderDoc::lang = undef; DiscussionHistorical versions of HeaderDoc used this in place
of passing this information around through the code.
This has been corrected in current versions, but
the HeaderDoc::man_sectionStorage for the $HeaderDoc::man_section = "3"; HeaderDoc::maxDecLenMaximum line length for wrapping declarations. $HeaderDoc::maxDecLen = 60; # Wrap functions, etc. if declaration longer than this length DiscussionYou can override this with the HeaderDoc::modulesPathThe location from which the HeaderDoc modules were loaded. $HeaderDoc::modulesPath = $INC{ 'HeaderDoc/ParseTree.pm' }; DiscussionThis variable is populated automatically. HeaderDoc::nameFromAPIRefReturnsOnlyNameStorage for the bareNamesFromAPIRefs flag $HeaderDoc::nameFromAPIRefReturnsOnlyName = 0; DiscussionBy default, if you use an @link tag and
specify only an API reference marker (apple_ref),
as a link destination (with no link text),
HeaderDoc substitutes a class method call for
Objective-C methods and a name in the form
If you set this flag to 1, this behavior is disabled for Objective-C methods. If you set this flag to 2, this behavior is disabled for non-Objective-C methods. If you set this flag to 3, this behavior is disabled for all methods. HeaderDoc::namerefsUsed for quickly looking up names of fields in data types by the data type name and field name. %HeaderDoc::namerefs = (); HeaderDoc::newTOCNew TOC style variable. $HeaderDoc::newTOC = 0; DiscussionSet by HeaderDoc::outerNamesOnlyEnables/disables "outer name" type handling ( $HeaderDoc::outerNamesOnly = 0; # storage for -O flag. DiscussionBy default, HeaderDoc documents all names for type declarations. This flag disables emission of documentation for inner (structure, enumeration, or union) tag names declared inline. For example, HeaderDoc::parse_javadocEnables support for JavaDoc-style comments (comments with a second asterisk at the start of the comment instead of an exclamation point). $HeaderDoc::parse_javadoc = 0; HeaderDoc::parseIfElseEnables parsing of a bit more of the C programming language to support nonstandard (external) uses of the parser. $HeaderDoc::parseIfElse = 0; DiscussionHeaderDoc itself does not use this functionality. HeaderDoc::parsing_man_pagesMagic flag used when parsing manual page declarations. $HeaderDoc::parsing_man_pages = undef; DiscussionSet to 1 if (in C) you want a function declaration
to end after the closing parenthesis even if there
is no trailing semicolon. Do NOT set this for
normal parsing; it will break many typedef
declarations and similar. This also enables
some broken man page detection for deleting lines
that say Note that HeaderDoc does not actually set this flag. It is used by other tools that share this parser. HeaderDoc::perHeaderIgnoreFuncMacrosDeprecated. %HeaderDoc::perHeaderIgnoreFuncMacros = (); DiscussionStorage for an old scheme to ignore junk CPP tokens at the start of line.
This holds the list of values from The currently recommended way to do this is with the C preprocessor in the code itself. HeaderDoc::perHeaderIgnorePrefixesDeprecated. %HeaderDoc::perHeaderIgnorePrefixes = (); DiscussionStorage for an old scheme to ignore junk CPP tokens at the start of line.
This holds the list of values from The currently recommended way to do this is with the C preprocessor on the command line (-D FOO="") or in code. HeaderDoc::perHeaderIncludesA list of %HeaderDoc::perHeaderIncludes = (); HeaderDoc::perHeaderRangesA list of line numbers where CPP %HeaderDoc::perHeaderRanges = (); DiscussionUsed for determining which C preprocessor directives should be applied to a given block of code. HeaderDoc::perlClassChangeProvides an out-of-band way for the block parser to change the main API owner at the top level of HeaderDoc. $HeaderDoc::perlClassChange = undef; DiscussionUsed to work around the rather odd way Perl's classes are designed. (They have no end, and due to limitations in HeaderDoc, they cannot be parsed as a single block and pulled apart as other languages can.) Normally, this is empty. When set by the parser, the top-level API owner is reset to that object. HeaderDoc::process_everythingStorage for the $HeaderDoc::process_everything = 1; HeaderDoc::reverse_matchThe specific value that causes HeaderDoc
to treat the $HeaderDoc::reverse_match = 0; DiscussionHeaderDoc See Also HeaderDoc::skiplistThe skiplist file. $HeaderDoc::skiplist = ""; DiscussionIf HeaderDoc is processing a single directory as its input,
it looks for a file at the top level of that directory called
HeaderDoc later uses this list to determine which files
to skip when processing the content. Note that the
preferred way to do this is with exclude lists (the
HeaderDoc::skipNextPDefineDisables adding the next $HeaderDoc::skipNextPDefine = 0; DiscussionTriggered by a HeaderDoc::sort_entriesStorage for the $HeaderDoc::sort_entries = undef; DiscussionSet to HeaderDoc::specified_config_fileThe configuration file path specified by the $HeaderDoc::specified_config_file = ""; HeaderDoc::styleImportsStorage for the $HeaderDoc::styleImports = undef; HeaderDoc::styleSheetExtrasStorage for the contents of the file described in the
$HeaderDoc::styleSheetExtras = undef; HeaderDoc::sublangGlobal variable where the language info for the header currently being parsed is stored. $HeaderDoc::sublang = undef; DiscussionHistorical versions of HeaderDoc used this in place
of passing this information around through the code.
This has been corrected in current versions, but
the HeaderDoc::superclassNameStorage for the $HeaderDoc::superclassName = "Superclass"; HeaderDoc::suppress_local_variablesTells HeaderDoc to suppress local variable documentation. $HeaderDoc::suppress_local_variables = 0; DiscussionBy default, a local variable (an Passing the HeaderDoc::suppressDefaultJavaScriptStorage for the $HeaderDoc::suppressDefaultJavaScript = 0; HeaderDoc::suppressDefaultStylesStorage for the $HeaderDoc::suppressDefaultStyles = 0; HeaderDoc::testdirThe HeaderDoc test suite location. $HeaderDoc::testdir = $HeaderDoc::modulesPath."/../../testsuite"; DiscussionIf HeaderDoc is being run out of a checked out copy.
this is the testsuite directory in that checked out
copy. Otherwise, this uses the installed path,
HeaderDoc::testmodeStorage for the $HeaderDoc::testmode = undef; HeaderDoc::tocStyleImportsStorage for the $HeaderDoc::tocStyleImports = undef; HeaderDoc::truncate_inlineControls whether to include the body of macros or not. $HeaderDoc::truncate_inline = 0; DiscussionBy default, HeaderDoc omits the body of macro definitions
in the documentation. You can pass the HeaderDoc::twig_availableDeprecated. $HeaderDoc::twig_available = 0; DiscussionTwig isn't installed by default in Mac OS X. This is used in a feature that never got implemented---specifically, parsing modified HeaderDoc XML output and updating the HeaderDoc comments in the headers to allow round-tripping HeaderDoc markup through XML editor tools. (The need for this functionality never materialized. Also, in hindsight, a more lightweight, and more commonly installed XML parser API would also be better.) HeaderDoc::uniquenumberA counter used for generating UUIDs for inherited content. $HeaderDoc::uniquenumber = 0; HeaderDoc::use_iframesStorage for the $HeaderDoc::use_iframes = 1; DiscussionNote that this variable may get removed eventually in favor of a more flexible output style variable. HeaderDoc::use_stylesEnables emission of various stylesheet bits. $HeaderDoc::use_styles = 0; DiscussionSet if certain keys appear (with content) in the config file. headerdoc_stripStorage for the -s flag. my $headerdoc_strip; HeaderDoc_VersionThe version number of the HeaderDoc suite. my $HeaderDoc_Version = "8.9"; inputFilesThe array of input files to be procesed. my @inputFiles; isMacOSIf running in MacPerl in Mac OS 9, contains 1; normally 0. my $isMacOS; langLanguage currently being parsed. my $lang = "C"; man_outputStorage for the -m flag. my $man_output; pathSeparatorNormally "/", but ":" if running in MacPerl in Mac OS 9. my $pathSeparator; printVersionStorage for the -v flag. my $printVersion; quietLevelStorage for the -q flag. my $quietLevel; regenerate_headersStorage for the -r flag (not yet implemented). my $regenerate_headers; reprocess_inputIn practice, this goes high whenever HeaderDoc encounters
an my $reprocess_input = 0; specifiedOutputDirStorage for the -o flag. my $specifiedOutputDir; use_stdoutStorage for the -P flag. Also set for the -f flag. my $use_stdout; VERSIONThe revision control revision number for this script. my $VERSION = '$Revision: 1334261201 $'; DiscussionIn the git repository, contains the number of seconds since January 1, 1970. xml_outputStorage for the -X flag. Also set for the -m flag. my $xml_output; |