Description | ||
Name of the file in which the graph is being stored. |
Description:
This procedure writes a window's subgraph to a file as a set of
Rigi Standard Format (RSF) tuples. The resulting RSF file is
a "flat" or "non-hierarchical" file. The
file can be reread using the rcl_read_rsf
procedure.
The rsfName is the full file specification (including the
directory path).
Return Value:
If an error occurs, -1 is returned; otherwise a non-negative value
is returned.
Exceptions:
Errors are reported if the procedure is unable to open the output
file.
Example:
# Procedure to write all Rigi drawing windows # to a single RSF file. proc writeRSF {file} { # Get all of the Rigi drawing Windows. set wins [winfo children .] set currentWinId [rcl_win_get_id] # Write the rsf from each window # to individual scratch files. set winids "" foreach win $wins { # A Rigi drawing window should have a # path name of .window<n> where n is a # window ID. if {[scan $win ".window%d%s" winid dummy] == 1} { lappend winids $winid # Set the active window since rcl_write_rsf # operates on only the active window. rcl_win_select $winid if {[rcl_write_rsf $file$winid] == -1} { rcl_msg "Error writing to $file$winid" return -1 } } } # Reset the active window. rcl_win_select $currentWinId # Collect each of the scratch files into # a single output file. if {[catch {set ofid [open $file w]}]} { rcl_msg "Error opening $file" return -1 } foreach winid $winids { if {[catch {set ifid [open $file$winid r]}]} { rcl_msg "Error opening $file$winid" close $ofid return -1 } while {[gets $ifid rec] != -1} { puts $ofid $rec } close $ifid # Delete the scratch file. # execfg is a Rigi extension to the Tcl exec # command. It searches the path and executes # a command in foreground mode. execfg rm $file$winid -catch } close $ofid }