Skip to content

fpp locate uses

Rob Bocchino edited this page Jun 4, 2024 · 5 revisions

This tool parses FPP source files and reports the locations of symbols used in the files. It is useful for diagnostic purposes.

As an example, you can do the following:

  1. Run fpp-locate-defs to construct a file exported.fpp containing the locations of some exported symbols.

  2. Run fpp-depend exported.fpp client.fpp to generate a list F of files on which client.fpp depends. Turn F into a comma-separated list F1.

  3. Run fpp-locate-uses -i F1 client.fpp to see the locations of symbols exported in exported.fpp and used in client.fpp.

Options:

  1. -d dir: Specify the base directory for locating files. The default directory is the current directory.

  2. -i files: Import files. These files are read in for their symbols, but uses in the files are not reported.

Input:

  1. A list fl_tr of files specified on the command line.

  2. A list fl_i of files to import, specified as arguments to the -i option.

Output:

  1. An FPP source file, written to stdout. The source file contains one location specifier for each symbol used in fl_tr.

Procedure:

  1. Parse each of the files in fl_tr, generating a list tul_tr of translation units. When parsing, recursively resolve include specifiers.

  2. Do the same for fl_i, generating a list tul_i.

  3. Perform semantic checking on the concatenation of tul_fl and tul_i.

  4. For each use u appearing in tul

    1. Look up the definition d corresponding to u.

    2. Add the symbol corresponding to d to the used symbol set S.

  5. For each symbol s in S

    1. Use the parent symbol map to get the qualified name of s.

    2. Write out a location specifier for the definition corresponding to s.