Description | ||
Name of a Tcl callback proc |
Description:
This procedure causes Rigi to call the Tcl proc specified for
each node and arc in the graph. The Tcl proc must be declared
as taking two parameters:
proc callback {objid objtype} { ... }
The objid is the
Rigi node ID or arc ID. The objtype
has a value of either "arc" or "node." All
nodes and arcs in the graph are passed to the Tcl proc, including
those that are not visible and those that in the clipboard.
Return Value:
None.
Exceptions:
None.
Example:
# Write an unstructured (flat) RSF file for the entire # graph to stdout. Note that the rcl_write_rsf proc # writes only the active window to an unstructured RSF file. # First define the callback proc ... proc write_flat_rsf {objid objtype} { if {$objtype == "node"} { set typenum [rcl_get_node_type $objid] # Ignore nodes of type "Collapse" because # they define structure if {[rcl_get_collapsenode] != $typenum} { # Write a tuple describing the node. set typename [rcl_get_nodetypename $typenum] set name [rcl_get_node_name $objid] puts type\t\"$name\"\t$typename } } else { set typenum [rcl_get_arc_type $objid] # Ignore arcs of types "level" and # "composite" because they define structure if {[rcl_get_levelarc] != $typenum && \ [rcl_get_compositearc] != $typenum} { # Write a tuple describing the arc. set typename [rcl_get_arctypename $typenum] set srcid [rcl_get_arc_src $objid] set src [rcl_get_node_name $srcid] set dstid [rcl_get_arc_dst $objid] set dst [rcl_get_node_name $dstid] puts $typename\t\"$src\"\t\"$dst\" } } } # Then get Rigi to pass data to the callback proc ... rcl_kb_dump write_flat_rsf