The CAMEL Search Tool

One of the most important and often neglected tools in UNIX for programming is the text search command, grep. The CAMEL tool in Desert is a visual front end that extends grep-like search capabilities using the project databases accumulated by the system. CAMEL allows the user to ask any of a range of queries. These include grep-like commands against all files in a project (see COMD), as well as queries against the various relations in the semantic database maintained by Desert. Future capabilities will allow the user to define new queries interactively.  CAMEL can be initiated by the command xstartcamel.

The Camel interface contains two sets of buttons, a set of pull-down menus, and a display area. The display area contains the results of the various searches displayed as reason-file-line triples. The reason gives a brief summary of why the tuple is present, the file-line pair of the tuple indicate the result of the search. The user can use this displayed list to go to lines in the FRED editor or to build fragment files for semantic-based editing. For the later purpose, the list can be edited directly by the user or through queries.

The basic interface looks like:

The File menu contains buttons that are essentially duplicated by the buttons on the left side of the window.  The New button creates a new instance of a CAMEL viewer.  The new instance has an empty display list.  The Build command builds a fragment file using the current displayed list.  The Browse command is currently not implemented.  The Clear command clears the display list.  The Sort command sorts the display list after asking the user for the sorting critera.  The Set Project command allows the user to set or change the project that queries are issued against.  Finally the Dismiss or Quit button closes this window (and exits CAMEL if this is the last CAMEL window open).  

The Query menu contains buttons that activate the predefined queries.  Each query causes an appropriate dialog box to be brought up.  The user can then enter whatever qualifiers are known in the appropriate place in the dialog box.  Four queries are currently defined, Calls, Definitions, Text Search, and References.  Calls queries against function and method calls. Definitions queries against definitions of names.  Text Search is the equivalent of grep, searching all files in the project for the given string or pattern.  References looks for all references to a given name or pattern.

 The references dialog box, as an example, looks like:

Here the user can enter any of the fields.  Any field that is not specified will not be used as a qualifier for the search.  The name field contains the name or the pattern.  The option to the right of this field allows the user to specify whether the name should be matched exactly, ignoring case, or whether the name is a regular expression pattern that should be matched.  The symbol type specification allows the user to select one or more types of symbols to which the reference can occur.  The butons at the bottom of the dialog box control the query.  The Add button causes all tuples found by the query  to be added to the current display list.  The Replace button removes all old tuples from a reference query and adds the new tuples.  The Remove button removes all tuples that match the results of the query.  Finally, the Dismiss button removes the dialog box.

The dialog boxes for the other query types are similar. The only one that differs is the text search query. This dialog takes two items, the pattern string and the type of search. The valid search types are Exact Match to grep for the pattern as a literal string in all valid search files, Nocase Match to search for the pattern as a case-insensitive string in all valid source files, and Pattern to search for a regular expression over all valid source files. The source files here are all text files contained in the current project. In addition, two token-based search options are available, Token Search and Token Pattern. These look for all references to a token matching the given string (or regular expression pattern) using the semantic database.

The Element menu is used for controlling the display list. Buttons corresponding to the buttons on this menu can be found on the bottom of the window. These buttons include Goto to cause the editor to display the file and line of the currently selected display item, Delete to delete the currently selected display item, Select All to select all display items, and Unselect to remove the current selections.

Finally the Monitor menu controls another feature of the CAMEL subsystem. CAMEL has the ability to monitor the message server looking for messages that indicate possible items for the CAMEL display. Each of these messages is labeled with a type and contains the file, line and other information. Such messages are generated automatically for compilation errors and warnings and for user focus requests from various tools. When monitoriting is enabled for a particular type, CAMEL will add a display item for each message that it finds. Thus is monitoring is enabled for Errors, then a display item will be created for each compiler error message.


If you have questions or problems, send email to Steve Reiss at spr@cs.brown.edu.

Or go back to the Desert home page.