TutorialBrowsing a Library




Prev | Up | Next | Back | Forward | Online Documentation Home Page

Browsing a Library

This chapter illustrates Ada-ASSURED's library browsing features using sample code provided for the purpose.

Loading a Names Database

The library browser uses a database that lists the locations of named Ada constructs. Such databases are generated and maintained using separate utility programs aa.tags and maketags. File aahome/files/demo.tags contains a sample database.

Load this database into Ada-ASSURED as follows:

  1. Invoke command load-names from the Tools/Names Browsing menu.

  2. In the popped up dialog box, either enter the full pathname of file demo.tags, or use the file-and-directory browser to locate it. Then click on OK.

Query-based Browsing

Command find-name provides a query-based browser that is useful for finding a definition or specification in existing code when you are unsure of its name or location. The search can be narrowed by restricting attention in various ways: the qualified form of names, the sort of entity sought (e.g., procedure, function, etc.), the kind of declaration (e.g., specification, definition, etc.), and the visible library context.

  1. Invoke find-name from the Tools/Names Browsing menu.

  2. To see all names in the database, enter the wildcard ``?'' for a name, click Match All to extend the search to all forms of entity, and then click Find. A list of some 114 names should appear.

  3. To narrow the query so that only names of package SPC_Numeric_Types are found, change wildcard ? to SPC_Numeric_Types.?, Then click Find again. Now there are only 16 matches.

  4. To narrow the query so that only certain categories of names are found, e.g., just procedures and functions, click off all choices in the Find grouping except procedures and functions, and then click Find again. Now there are only 4 matches.

  5. Select one of the remaining names in the list by clicking on it, and then click Open to see the definition.

  6. Experiment with the various choices provided in the dialog box.

  7. Click on Cancel.

Hypertext Browsing

Hypertext browsing helps you find declarations by simply clicking on names in the code. Two commands are provided:

X Windows

The find-spec command is bound to Alt+Select. The find-definition command is bound to Control+Select.

To locate a specification, press the Alt (or Meta) key and click Select (the left mouse button) on the name. To locate a definition, press the Control key and click Select on the name. If the name can be resolved to a unique definition, the appropriate file is opened (if necessary) and scrolled to the declaration. If the name is ambiguous, the find-name browser is popped up with an entry for each match. Names browsing is not supported for variables.

Microsoft® Windows® Operating System

The find-spec and \commandfind-definition commands are both bound to items on the Menu (right mouse button) menu.

To locate a specification, click Menu (the right mouse button) on the name, then select Find Spec on the menu that pops up. To locate a definition, click Menu on the name, then select Find Definition on the menu that pops up. If the name can be resolved to a unique definition, the appropriate file is opened (if necessary) and scrolled to the declaration. If the name is ambiguous, the find-name browser is popped up with an entry for each match. Names browsing is not supported for variables.

Browsing in TEXT Mode

By default, the library browser opens files in TEXT mode. A TEXT buffer can be converted to full Ada language-sensitivity by invoking command coerce-buffer from the menu.

X View/Buffers/Coerce Buffer...
MS Window/Coerce Buffer...

The library browser's default mode for opening files can be changed by toggling Browse as TEXT in the Tools/Names Browsing menu.

Creating a Names Database

Program aa.tags makes a names database from a list of Ada source files. Program maketags makes a names database for an entire Ada library. Whereas aa.tags is independent of the Ada compiler you are using, maketags depends on the specific library structure used by your Ada compiler. For further details, see the man entries for aa.tags and maketags.


Forward