5.1 Searching with PWB

PWB offers the following ways to search your files for information:

Visually inspecting code, moving with the cursor or the PGUP and PGDN keys. This method is most effective either when you are familiarizing yourself with some old code or after you have switched from CodeView back to PWB and want to examine the local impact of a proposed change.

Searching with text strings. When you have a specific string in mind (for example, FileName), you can find, in sequence, all the references to the name in your file.

Searching with regular expressions. Regular expressions describe patterns of text. This is useful when you have a number of similarly named program symbols and you'd like to see them all in succession.

For example, Windows API (application programming interface) names are made up of multiple words; the start of each new word is shown as a capital letter (for example, GetTextMetrics). With this in mind, you might search for
a string optionally starting with spaces and the letters “GetText” followed by
any uppercase letter. This is expressed with a regular expression such as *GetText[A-Z], which means zero or more spaces (using the * operator after
a space), followed by GetText, followed by any uppercase letter (using a character class).

Searching multiple files with text strings or regular expressions. A multifile search is called a “logged search.” Instead of finding one match, PWB finds all matches in one operation. You can then browse the results of the search.

Using the Source Browser. The Source Browser enables you to perform faster and more sophisticated searches than plain text searches because it maintains a complete database of relationships between program symbols. For example, to find all occurrences of FileName in your entire program (regardless of the number of files in the program), you can use the View References command from the Browse menu.

The Source Browser has many more capabilities than just finding symbols. It can also produce call trees and perform sophisticated queries on the use-and-definition relationships among functions, variables, and classes in your program.

These searching techniques are discussed in detail in the following sections.