This chapter describes all of the windows and features associated with the Browser. For tutorials demonstrating how the Browser is used, refer to Chapter 8, "Using the Browser for C++: A Sample Session," and Chapter 9, "Using the Browser for Ada: A Sample Session."
This chapter contains the following sections:
The Browsing Choices window lets you select items to be browsed from a list derived from the fileset in the Browser View window. Double-clicking an item in the selection list causes the Browser View window to be raised (moved to the front) with the chosen item as the current subject for analysis.
With C++ code, the Browsing Choices window displays one column to indicate the kind of item, a column to identify the item, and three columns indicating properties, as follows:
Kind—classes, template definitions, and template instances
Name—the name of the item
Abstract—abstract property: concrete (blank), abstract by declaration, or abstract by inheritance
Delta—delta property: dynamic, internal dynamic, or non-dynamic (blank)
Template—template property: specific definition, partial instantiation, or normal (blank)
The Browsing Choices window provides a facility for sorting items by column. To do this, click in the column you wish to sort on and select "Sort" from the Admin menu.
If you're using Ada, the Browsing Choices window displays packages, tasks, and tagged types in the Kinds column. The properties columns are not used in Ada and appear blank. You can sort the items by kind or name by clicking in the appropriate column and selecting "Sort" from the Admin menu.
Note: These features are available only if you have purchased the ProDev Ada package. |
Browser View is the primary Browser window (see Figure 10-2). It opens when you select "Browser" from the Admin menu of the WorkShop Static Analyzer, but does not display data until you select an item from the list in the Browsing Choices window. Browser View displays internal and related information for elements in Ada and C++ programs. The information is presented in hierarchical lists shown in outline format.
Browser View lets you perform a variety of static analysis database queries, depending on your current work context. Queries concerning the current subject are accessed from the Queries menu in the menu bar. You can also make queries specific to the selected elements in the list area by holding down the right mouse button to display a popup Queries menu specific to that type of element. The results of queries are indicated by highlighting matching elements in the Browser View window. Matching results are also highlighted in Source View, if it is displayed; and in the Static Analyzer, if the Show in Static Analyzer toggle is turned on (see "Show in Static Analyzer Toggle").
You can also launch graphical views showing hierarchies and call graphs from the Browser View window. In addition, you can generate reference pages and web pages from Browser View.
The Current Subject field indicates the kind and name of the element to be analyzed. It is directly below the menu bar (see Figure 10-2). The label on this field is initially Current Subject. To analyze an element, you can type directly into this field (or select from the Browsing Choices window). The label changes according to the kind of element you select. You can enter the following kinds of elements:
C++ class
C++ template definition
C++ template instance
Ada package (with ProDev Ada only)
Ada task (with ProDev Ada only)
Ada tagged type (with ProDev Ada only)
If you type a partial string and then press the <space bar>, the Browser attempts to complete the element name by searching the fileset. A beep indicates that more than one matching name exists. If a match is made, press the <Enter> key to make the change effective.
The Show in Static Analyzer toggle is directly to the right of the Current Subject field (see Figure 10-2). When the toggle is set (a check mark and the label Yes appear), the results of all queries are displayed in the WorkShop Static Analyzer window from which the Browser was launched, including the file, line number, and source line for the matching items. If no results are found and the Static Analyzer window is open, it comes to the front with an error message.
The Last Query button is at the top right of the window, directly beneath the Help menu (see Figure 10-2). Clicking this button displays the results of the most recent query in the WorkShop Static Analyzer window from which the Browser was launched.
The Browser View query identification area is directly above the list area (see Figure 10-2). This area displays the most recent query as a sentence containing both the query question and the name of the object of the query. The number of elements matching the query is displayed at the right end of the line.
The lower two-thirds of the Browser View window consists of two lists displayed in side-by-side panes (see Figure 10-2). The lists contain information about the currently selected subject and are organized by category in an outline format. The lists are:
member list—a detailed view of the internals of the current subject.
relation list—items related to the current subject.
You can change the relative widths of the panes by moving the sash that separates the panes.
The categories in the lists are different depending on whether you are using C++ or Ada code (with ProDev Ada only). Table 10-1 summarizes the contents of each list by programming language. For more information on the lists, see "C++ Member List", "C++ Relation List", "Ada Member List", and "Ada Relation List".
Table 10-1. Browser View List Summary
Language | Member List Contents | Relations List Contents |
---|---|---|
C++ | PUBLIC/INSTANCE/PRIVATE INSTANCE/STATIC TYPES/DATA/METHODS/ | BASE CLASSES (including the current class)/ DERIVED CLASSES/USES/ USED BY/ FRIEND FUNCTIONS/ FRIENDS/FRIEND OF |
Ada | SPEC PUBLIC/SPEC PRIVATE/ BODY CONTAINS/DATA/TYPE/ | PARENTS (including the current subject)/ DERIVED |
Each category name appears with an outline icon to its left, that is, a diamond-shaped icon that can be used to collapse (hide) or expand (make visible) the items under that category. Inside the icon there is an arrow that indicates whether the category is in the expanded or collapsed state. If the arrow points downward, the list is in its expanded state; all items are displayed. If the icon points to the right, the category is in its collapsed state; all items in that category are hidden. Clicking the arrow toggles the state of the category, displaying or hiding the category's contents. Another function of the outline icon is to indicate when a collapsed list contains items matching the current query. This is shown with a filled outline icon. See Figure 10-3.
The lists use annotated scroll bars as another way to locate highlighted list entries. When you make a query on an item in a list, the Browser displays indicator marks in the scroll bars in both panes corresponding to the relative positions of matching items. This informs you about all matches even if they are in collapsed categories or in a portion of the list that is not currently in view. If you click an indicator with the middle mouse button, you scroll directly to the matching item in the list. When the thumb of the scroll bar overlaps a given tick mark, the corresponding entry is visible in the list window. See Figure 10-3.
The Browser View member list displays the types, data members, methods, and virtual methods internal to the current class, template definition, or template instance when you are analyzing C++ code. It labels constructor methods as -constructor-> and destructors as --destructor->.
The members of the current class are sorted recursively into three nested lists according to the access specification (PUBLIC, PROTECTED, or PRIVATE) of each member. Within each of the access categories, the members are sorted by scope into two categories (INSTANCE and STATIC). Finally, within each category, members are displayed by member category type in this order: TYPE, DATA, METHODS (member functions), and VIRTUAL METHODS.
Here is a schematic of the outline format for each nested list:
Access (PUBLIC, PROTECTED, or PRIVATE) Scope (INSoTANCE or STATIC) TYPES DATA METHODS VIRTUAL METHODS |
The accessibility categories are:
The scope categories are:
static members—all objects of a given class contain the same value for a given member
instance (non-static) members—members in different instances of that class can contain different data values
Class members fall into these categories:
types—definitions of data types declared within a class
data—variables that contain state information for a class
methods (or member functions)—definitions of how a class interacts with other classes and structures
virtual methods—methods for an object that ensure that the method invoked is defined by the class from which the object was instantiated, regardless of type casting
The list organization is customizable. For more information, refer to Appendix A.
Double-clicking any member in the member list opens a Source View window containing that member's code with the declaration highlighted. See Figure 10-4.
The C++ relations list displays the current class and its related classes in the related class list. The categories in the list are:
BASE CLASSES—contains the current class and its ancestors, listed hierarchically
DERIVED CLASSES—contains descendants of the current class, listed hierarchically
USES—contains classes that the current class uses (that is, instantiates, destroys, interacts with, or contains)
USED BY—contains classes that the current class is used by
FRIEND FUNCTIONS—contains global functions declared as friends by the current class
FRIENDS—contains classes that are declared as friends by the current class.
FRIEND OF—contains classes that declare the current class as a friend.
Within this list, the current class is displayed as follows:
<- This |
which refers to the class in the Current Class field.
Double-clicking any class listed in the related class list makes it the new current class. Double-clicking a friend function brings up a Source View window highlighting the function's definition.
The Base Classes category shows the ancestors of the current class, if any. Each indented class is an ancestor of the class listed above it. The Base Classes category indicates a multiple inheritance relationship by indenting parent classes to the same level. If a given class has ancestors, it is accompanied by an outline icon, which works in a similar manner to the outline icons in the member list. Each ancestor name is followed by its inheritance access type (public, protected or private) listed in parentheses.
This schematic gives an example of a Base Classes category:
BASE CLASSES <-This first_parent_of_This (access type) parent_of_first_parent_class (access type) second_parent_of_This (access type) parent_of_second_parent_class (access type) |
The Derived Classes category shows the descendants of the current class, if any. Each indented class is a descendant of the class listed above it. If a given class has descendants, it is accompanied by an outline icon, which works in a similar manner to the outline icons in the base classes category and member list.
This schematic gives an example of a possible Derived Classes category:
DERIVED CLASSES first_child_of_This child_of_first_child_class second_child_of_This child_of_second_child_class |
Note: The features described in this section are available only if you have purchased the ProDev Ada package. |
The Ada version of the Browser View member list displays packages, task types, and tagged types as its current subjects. Packages have functions as their internal "members." The internal members for task types are entries (under Public) and functions. Tagged types have primitive operations as their internal members.
The members of the current subject are sorted recursively into three nested lists according to the access specification (SPEC PUBLIC, SPEC PRIVATE, or BODY) of each member. Under each of the access categories lies the INSTANCE subcategory. Finally, the members are displayed by member category type in this order: TYPES, DATA.
Here is a schematic of the outline format for each nested list:
Access (SPEC PUBLIC, SPEC PRIVATE, or BODY) Scope (INSTANCE) TYPES DATA |
The accessibility categories are different depending on the type of Ada entity.
The accessibility categories for packages are:
spec public—includes declarations of data, functions, and types made in the public part of the package spec
spec private—includes declarations of data, functions, and types made in the private part of the package spec
body—includes declarations and definitions of data, functions, and types made in the implementation of the package. These symbols are usable only within the package body.
The accessibility categories for tagged types are:
spec public—includes data lists components of the tagged type. Functions list primitive operations of the tagged type.
Note: There is no spec private or body section for a tagged type. |
The accessibility categories for task types are:
spec public—includes functions listed here are entries to the task. Types and data listed here are public (ie usable by a client of the task).
body—includes types, data, and functions used in the implementation of the task. These symbols are usable only within the task body.
Note: There is no spec private section for tagged types |
The other categories are:
types—definitions of data types declared by a package, task, or tagged type
data—variables that contain state information for a package, task, or tagged type
The list organization is customizable. For more information, refer to Appendix A, "Customizing the C++ Browser."
Double-clicking any member in the member list opens a Source View window containing that member's code, with the declaration highlighted. See Figure 10-4.
This section describes the menus, found in the Browser View menu bar (see Figure 10-6).
"Change Current Subject" |
| |
"Another Browser View" |
| |
"Close Browser View" |
|
"Generate Man Pages..." |
Select individual subjects by clicking them. If you want a reference page for every subject in the list, click Select All. To remove selections you've made, click Unselect All. Clicking the Generate button creates a reference page template for each selected subject. If reference pages exist for any selected subjects, the Browser warns you, unless you set the Warn Overwrite toggle to No. Output files go in the directory shown in the Man Page Directory field, if it exists. To specify a different output directory, click the Set Directory button in the Man Page Generator window and enter your choice. |
"Generate Web Pages ..." |
Select individual subjects by clicking them. If you want a reference page for every subject in the list, click Select All. To remove selections you've made, click Unselect All. Clicking the Generate button creates a reference page template for each selected subject. If reference pages exist for any selected subjects, the Browser warns you, unless you set the Warn Overwrite toggle to No. Output files go in the directory shown in the Web Page Directory field, if it exists. To specify a different output directory, click the Set Directory button in the Web Page Generator window and enter your choice. | |
"Exit Browser" | Quits the C++ Browser, closing all windows launched from it (except Source View). The Static Analyzer window from which the browser was launched is not affected. |
"Show Previous Subject" |
| |
"Show History" |
To select a subject, click it and press Apply or OK. Double-clicking a subject has the same effect as OK; it makes the selection and closes the window. The selected class then becomes the current subject in the Browser View window. |
"What Is Declared" | ||
"What Is Defined" | ||
"What Is Overridden By" |
| |
"What is Pure Virtual" |
| |
"What Instantiates" |
| |
"What Destroys" |
| |
"What Uses" submenu (see Figure 10-15) |
Displays the classes that use the current class in these contexts:
| |
"What Is Instantiated" |
| |
"What Is Destroyed" |
| |
"What Is Used" submenu (see Figure 10-16) |
Displays those classes used by the current class in these contexts:
Additional queries on subjects, data members, and methods are accessible from popup menus described in "C++ Member List" and "C++ Relation List". |
The Preference menu allows you to control how the class information is displayed in the window (see Figure 10-17).
The selections are:
The Browser View popup queries menus provide queries for currently selected items in the outline list areas. These menu are accessed by selecting an item and then holding down the right mouse button. Figure 10-18 shows all of the popup menus available in Browser View.
This section describes:
Many of the same queries in the class popup menus appear in more than one menu. To eliminate this redundancy, each query is described once and presented in a single list rather than by menu.
The Data Members popup menu performs these queries on data members selected in the member display list:
The Methods popup menu lets you perform the following queries on methods shown in Figure 10-20.
The Methods popup menu provides these queries:
This section describes the popup menus available in the related class list display. These menus are shown in Figure 10-18. (Note that the queries menu that displays when you select <-This is not shown here; it's exactly the same as the main Queries menu shown in Figure 10-14.)
Many of the items in the class popup menus are common to more than one menu. To eliminate the redundancy of describing them in each menu, this section presents all the queries in a single list in alphabetical order. The menus they belong to are shown in parentheses. Here are the menu items:
"New Browser View" (all menus except Friend Functions) |
| |
"Show Source" (all menus) |
| |
"What Destroys" (Uses and Used By) |
| |
"What Instantiates" (Uses and Used By) |
| |
"What Is Declared" (Base Classes) | ||
"What Is Defined" (Base Classes) | ||
"What Is Overloaded" (Derived Classes) |
| |
"What Is Overridden" (Base Classes) |
| |
"What Is Overridden" (Derived Classes) |
| |
"What Is Used" (Friends) |
| |
"What Is Used" (Derived Classes and Used By Classes) |
Contains these queries in the submenu (see Figure 10-7):
| |
"What It Uses" (Friend Function) |
| |
"What Uses" (Friend of Class) |
| |
"What Uses" submenu (Uses Classes) |
|
The Browser provides the Graph Views window, a graphical view for showing relationships between classes in the fileset (see Figure 10-23). It depicts classes as nodes and relationships as arcs. The Graph Views window can show four types of class relationships:
Inheritance
Containment
Interaction
Friends
You can display the graphical views by selecting any of the following items from the Views menu of the Browser View window:
"Show Inheritance Graph"
"Show Containment Graph"
"Show Interaction Graph"
"Show Friends Graph"
Once the Graph Views window is displayed, you can switch to any of the other relationships by using the Relationship menu at the bottom right of the Graph Views window (see Figure 10-23).
"Save Graph" | Allows you to save the graph to a file. It brings up the file selection dialog shown in Figure 10-24. When you select your file and click OK, you save the graph as a PostScript® file with the name specified in "Selection." | |
"Close" | Closes the Graph Views window. |
The Graph Views window Views menu (see Figure 10-23) commands control which classes included in the current fileset are displayed in the Graph Views window. The choices are:
The Call Graph window shows all calls made from selected methods in the member list, including calls made from its target methods. You can invoke it by
selecting "Call Graph" from the Views menu in Browser View
selecting a method in the member list, displaying the Methods popup menu, and selecting "Call Graph:Add." This displays the Call Graph window the first time and adds new methods to the graph each time you select "Call Graph:Add."
Figure 10-25 illustrates the second method for displaying Call Graph. The user has selected the initialize method in the Browser window and then selected "CallGraph:Add" from the Methods popup menu. The initialize method now appears in the Call Graph window with the methods that it calls.
You add, replace, or remove methods in the Call Graph by choosing from the Call Graph submenu in the Methods popup menu in the Browser View member list (see Figure 10-25), as follows:
"Add" adds the currently selected method and its calling structure to the Call Graph window, if one is open. If not, "Add" opens a Call Graph window and then adds the method.
"Replace" replaces all methods in the display with the selected method and its calling structure in the Call Graph window.
"Remove" removes the currently selected method and its calling structure from the Call Graph window.
The action you request is displayed in the message area in Browser View. In the Call Graph window, there is also a message area that identifies the method and its arguments.
In the Call Graph window, double-clicking any method node opens a Source View window displaying the code that defines the method. The definition is highlighted in the source.
For information on manipulating graphs, see Appendix A, "Using Graphical Views," in the ProDev WorkShop Overview.
The Call Graph window's Admin menu contains the following selections:
"Show Arglist" toggle |
| |
"Clear" | ||
"Save Graph" | Displays a file selection dialog for saving the graph to a PostScript file. | |
"Close" | Closes the Call Graph window. |