# Generic Function Queries

The generic function query allows you to select functions by means of the following form.

## Function Query

C function
Function-like macro
Writable declaration
Read-only declaration
Project scope
File scope
Defined

Sort-by | Metric | Compare | Value
--- | --- | --- | ---
| Number of characters |  |
| Number of comment characters |  |
| Number of space characters |  |
| Number of line comments |  |
| Number of block comments |  |
| Number of lines |  |
| Maximum number of characters in a line |  |
| Number of character strings |  |
| Number of unprocessed lines |  |
| Number of C preprocessor directives |  |
| Number of processed C preprocessor conditionals (ifdef, if, elif) |  |
| Number of defined C preprocessor function-like macros |  |
| Number of defined C preprocessor object-like macros |  |
| Number of preprocessed tokens |  |
| Number of compiled tokens |  |
| Number of statements or declarations |  |
| Number of operators |  |
| Number of unique operators |  |
| Number of numeric constants |  |
| Number of character literals |  |
| Number of if statements |  |
| Number of else clauses |  |
| Number of switch statements |  |
| Number of case labels |  |
| Number of default labels |  |
| Number of break statements |  |
| Number of for statements |  |
| Number of while statements |  |
| Number of do statements |  |
| Number of continue statements |  |
| Number of goto statements |  |
| Number of return statements |  |
| Number of project-scope identifiers |  |
| Number of file-scope (static) identifiers |  |
| Number of macro identifiers |  |
| Total number of object and object-like identifiers |  |
| Number of unique project-scope identifiers |  |
| Number of unique file-scope (static) identifiers |  |
| Number of unique macro identifiers |  |
| Number of unique object and object-like identifiers |  |
| Number of global namespace occupants at function's top |  |
| Number of parameters |  |
| Maximum level of statement nesting |  |
| Number of goto labels |  |
| Fan-in (number of calling functions) |  |
| Fan-out (number of called functions) |  |
| Cyclomatic complexity (control statements) |  |
| Extended cyclomatic complexity (includes branching operators) |  |
| Maximum cyclomatic complexity (includes branching operators and all switch branches) |  |
| Structure complexity (Henry and Kafura) |  |
| Halstead complexity |  |
| Information flow metric (Henry and Selig) |  |
| Entity name |  |

Reverse sort order

Match any marked Match all marked Exclude marked Exact match

Number of direct callers |  |
Function names should ( not) match RE |
Names of calling functions should ( not) match RE |
Names of called functions should ( not) match RE |
Select functions from filenames ( not) matching RE |

Query title

Main page — Web: Home Manual

CScout

On the top you can specify whether each function you want listed:

- is a C function
- is a function-like macro
- has a writable declaration
- has a read-only declaration
- is visible in the whole project scope
- is visible only in a file scope
- has a definition body.

As is the case in file queries, next comes a series of metrics CScout collects for each defined function. For each metric (e.g. the number of comments) you can specify an operator `==, !=, <` or `>` and a number to match that metric against. Thus to locate functions containing `goto` statement you would specify
Number of goto statements `!=` 0.

On the left of each metric you can specify whether that metric will be used to sort the resulting file list. In that case, the corresponding number will appear together with each file listed. A separate option allows you to specify that files should be sorted in the reverse order.

Similarly to the identifier query, you can also specify whether the specified properties should be treated

- as a disjunction (match any marked),
- as a conjunction (match all marked),
- as a negation excluding all identifiers matching any property (exclude marked), or
- as an exact match specification matching only identifiers that match exactly the properties specified (exact match)

In addition you can specify:

- That the function should have a specified number of direct callers.
- A regular expression against which function names should match (or not match)
- A regular expression against which the names of calling functions should match (or not match)
- A regular expression against which the names of any called functions should match (or not match)
- A regular expression that filenames in which functions are declared occur should match (or not match)
- A query title to be used for naming the result page. The title will appear on the result document annotating the results, and will also provide you with a sensible name when creating a bookmark to it.

Contents | « Previous Next (Global Options) »