ident script

This script manages the HTTP requests for identifier search.

countfiles ($refs)

Function countfiles returns the number of files for the references.

  1. $refs

    a reference to an array containing the references

The result can be used to display a short informative message.

checkvalidref ($file)

Function checkvalidref is a "$variable" substitution function. It returns CSS class name identinvalid if the file timestamp is incorrect, meaning the file has been modified after genxref indexing. Otherwise, it returns an empty string.

  1. $file

    a string containing the filename to check

Bad referenced file counter is updated to note the existence of possible trouble.

expandwarning ($templ)

Function expandwarning is a "$function" substitution function. It returns its argument if bad referenced file counter is not zero. Otherwise, it returns an empty string.

  1. $templ

    a string containing the template (i.e. argument)

The block for this marker should contain some warning message for inaccurate cross-references.

ref_in_file ($desc, $css, $path, $line)

Function ref_in_file is an auxiliary front-end function to fileref to handle the case of negative line numbers.

  1. $desc

    a string containing the visible text for the link

  2. $css

    a string containing HTML class attribute

  3. $path

    a string containing the file name for the link

  4. $line

    an integer equal to the line number

A negative line number flags a match in case insensitive mode. The real identifier may differ in case from the search key. Such a reference will be marked identapprox to flag the approximative match.

refsexpand ($templ, $refs)

Function refsexpand is a "$function" substitution function. It returns an HTML string which is the concatenation of its expanded argument applied to every reference in array $refs.

  1. $templ

    a string containing the template (i.e. argument)

  2. $refs

    a reference to an array containing the usages

The block may use one of two variants for the usages. The variant is detected from $lines marker use in the template. Processing is then dispatched on the "one ref per line" (no $lines marker) or "many refs per line" ($lines marker used) processing.

This basic expansion function is used both for definitions and uses. The difference is driven by the block content.

CAVEAT:

cmprefs ($a, $b)

Function cmprefs compares its arguments and returns +1, 0 or +1 if the left argument precedes, is equal or follows the right argument.

  1. $a, $b

    references to the arrays to compare

The references are arrays containing the file name and line number of the reference. For definitions, these elements are followed by type name and parent name.

Note:

defsexpand ($templ)

Function defsexpand is a "$function" substitution function. It returns an HTML string which is the concatenation of its expanded argument applied to every declaration.

  1. $templ

    a string containing the template (i.e. argument)

The function queries the database for definitions, then hands over definition layout to refsexpand.

Since some languages are case-insensitive, the database is also queried for the case-insensitive version of the identifier. The returned definitions are flagged with their line numbers set negative. The two lists are merged, removing duplicates and sorted as if a single query was made.

usesexpand ($templ)

Function usesexpand is a "$function" substitution function. It returns an HTML string which is the concatenation of its expanded argument applied to every usage.

  1. $templ

    a string containing the template (i.e. argument)

The function queries the database for usages, then hands over definition layout to refsexpand.

Since some languages are case-insensitive, the database is also queried for the case-insensitive version of the identifier. The returned definitions are flagged with their line numbers set negative. The two lists are merged, removing duplicates and sorted as if a single query was made.

printident ()

Procedure printident is the main driver for identifier search.

It retrieves template 'htmldir' and expands it using the dedicated functions defined in this file.

Script entry point

Builds the header and footer and launches printident for the real job.