As is the case with all modules in the simulator display, all of the graphical work is done in Tcl scripts. This provides for quick development, as no recompilation is necessary when making changes to a module under development. In most cases, we can even test changes in a module on the fly, without restarting the display process, simply by re-sourcing the Tcl file.
The Tcl code for the PerformUpdatePath procedure, which displays a route on the network topology display, is shown in Figure 7. It is called by the HandlePath C function described in Section 3.2. The display's path module relies on the fact that the network topology display module is implemented in a Tk canvas window and assigns tags to all of the routing arrows on the display as follows. Each line segment associated with switch x has a tag of the form ``switchx.'' In addition, each segment on the path leading from input port y to output port z at a switch has a tag of the form ``inyoutz.''
As indicated in Figure 3, the switchInfo argument to PerformUpdatePath contains a list of switch ID, input port, output port triples. To highlight a path, we find all canvas items (line segments) tagged with both the switch tag for the appropriate switch ID and the in/out tag for the given input/output ports. Note that Tcl/Tk does not provide a direct means of locating canvas items based on two or more specified tags. We could have modified the network topology module to add an additional tag of the form ``switchxinyoutz'' so a search could be done for a single tag. Instead, we chose to implement the canvasMultiMatch procedure to provide this missing functionality so we wouldn't need to modify the network topology module each time a search on a different group of tags was required. We then duplicate each item found and copy all attributes of the original line segment to the newly created segment, which by default is now on top of the canvas stacking order. We set the new segments to a color from a predefined color list, increase the line width, and tag the new elements with a unique tag so they can be easily distinguished later. In addition, we set a mouse binding to allow the user to change the color or persistence of the path. Finally, if the path is not persistent, we create a timer callback to delete the path after a predefined interval.
Although it is not shown here, the path module also contains a few other Tcl procedures. PathControlWindow implements a palette-like control panel interface allowing the user to change the color or persistence properties of a displayed route. Additional procedures are used to notify other modules of the posting and removal of path displays, should they wish to annotate their displays accordingly. For example, a session route displayed in black causes the corresponding entry in the session list window to be highlighted in black, as shown in Figure 2.