< Previous | Contents | Next >

17. THE INSPECTOR

image


The Inspector is a window-oriented tool designed to examine data structures. Because Medley is such a powerful programming environment, many types of data structures would be difficult to see in any other way.


Calling the Inspector


Take as an example an object defined through a sequence of pointers (i.e., a bitmap on the property list of a window on the property list of an atom inaprogram.)

To inspect an object named NAME, type:

(INSPECT ’NAME)

If NAME has many possible interpretations, an option menu will appear. For example, in Interlisp-D, a litatom can refer to both an atom and a function. For example, if NAME

was a record, had a function definition, and had properties on its property list, then the menu would appear as in Figure 17-1.



image


Figure 17-1. Option Window for Inspection of NAME

If NAME were a list, then the option menu shown in Figure 17.2 would appear. The options include:

• Calling the display editor on the list

• Calling the TTY editor (see Chapter 6)

• Seeing the list’s elements in a display window. If you choose this option, each

element in the list will appear in the right column of the Inspector window. The left column of the Inspector window will be made up of numbers (see Figure 17-3).

• Inspecting the list as a record type (this last option would produce a menu of known record types). If you choose a record type, the items in the list will appear in the

right column of the Inspector window. The left column of the Inspector window will be made up of the field names of the record.


image

Figure 17-2. Option Window for Inspection of List


Using the Inspector


If you choose to display your data structure in an edit window, simply edit the structure and exit in the normal manner when done. If you choose to display the data structure in an inspect window, then follow these instructions:

• To select an item, point the mouse cursor at it and press the left mouse button.

• Items in the right column of an Inspector window can themselves be inspected. To do this, choose the item, and press the center mouse button.

• Items in the right column of an Inspector window can be changed. To do this, choose the corresponding item in the left column, and press the center mouse button. You

will be prompted for the new value, and the item will be changed. The sequence of steps is shown in Figure 17-3.


The item in the lefl column is selected, and the middle mouse button pressed. Select the

SET option from the menu that pops up.

You will then be prompted for the new value. Type it in.

The item in the right column is updated to the value of what you typed in.

image


image


image

Figure 17-3. Steps Involved in Changing Value in Right Column of Inspector Window


Inspector Example


This example will use ideas discussed in Chapter 21. An example, ANlMALGRAPH , is created in that section. You do not need to know the details of how it was created, but the structure is examined in this chapter.

If you type

(INSPECT ANIMAL.GRAPH)

and then choose the Inspect option from the menu, a display appears as shown in

Figure 17-4. ANlMAL.GRAPH is being inspected as a list. Note the numbers in the left column of the inspectorwindow.

image

17. THE INSPECTOR

image


Figure 17-4. Inspector Window For ANIMAL.GRAPH , Inspected as List If you choose the "As A Record" option, and choose "GRAPH" from the menu that

appears, the inspector window looks like Figure 17-5. Note the fieldnames in the left column of the inspector window.

image


Figure 17-5. Inspector Window for ANlMAL.GRAPH , Inspected as Instance of GRAPH

Record


The remaining examples will use ANlMAL.GRAPH inspected as a list. When the first item in the Inspector window is chosen with the leff mouse button, the Inspector

window looks like Figure 17-6.


image


Figure 17-6. Inspector Window for ANlMAL.GRAPH With First Element Selected

When you use the middle mouse button to inspect the selected list element, the display looks like Figure 17-7.


image

Figure 17-7. Inspector Window for ANlMAL.GRAPH and for First Element of

ANIMAL.GRAPH


How you can see that six items make up the list, and you can further choose to inspect one of these items. Notice that this is also inspected as a list. As usual, it could also

have been inspected as a record.

Select item 5 - MAMMAL DOG CAT - with the left mouse button. Press the middle mouse button. Choose "Inspect" to inspect your choice as a list. The Inspector now displays the values of the structure that makes up MAMMAL DOG CAT . (See Figure 17-8.)


image

Figure 17-8. Inspector Window for Element S From Figure 17.7 That Begins ((MAMMAL DOG CAT).