From 8ab56c051f19f9c47cfb19519806a1adedd88d2f Mon Sep 17 00:00:00 2001 From: zrinka Date: Fri, 2 Dec 2005 10:36:26 +0000 Subject: [PATCH] source documentation for cfgparse.tcl Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- cfgparse.tcl | 76 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/cfgparse.tcl b/cfgparse.tcl index c994fbc..3dcdd03 100755 --- a/cfgparse.tcl +++ b/cfgparse.tcl @@ -33,6 +33,32 @@ # and Technology through the research contract #IP-2003-143. # +#****h* imunes/cfgparse.tcl +# NAME +# cfgparse.tcl -- file used for parsing the configuration +# FUNCTION +# This module is used for parsing the configuration, i.e. reading the +# configuration from a file or a string and writing the configuration +# to a file or a string. This module also contains a function for returning +# a new ID for nodes, links and canvases. +#**** + +#****f* nodecfg.tcl/dumpputs +# NAME +# dumpputs -- puts a string to a file or a string configuration +# SYNOPSIS +# dumpputs $method $destination $string +# FUNCTION +# Puts a sting to the file or appends the string configuration (used for +# undo functions), the choice depends on the value of method parameter. +# INPUTS +# * method -- used method. Possiable values are file (if saving the string +# to the file) and string (if appending the string configuration) +# * dest -- destination used. File_id for files, and string name for string +# configuration +# * string -- the string that is inserted to a file or appended to the string +# configuartion +#**** proc dumpputs {method dest string} { switch -exact -- $method { @@ -41,12 +67,26 @@ proc dumpputs {method dest string} { } string { global $dest - append $dest "$string " + append $dest "$string +" } } return } +#****f* nodecfg.tcl/dumpCfg +# NAME +# dumpCfg -- puts the current configuraton to a file or a string +# SYNOPSIS +# dumpCfg $method $destination +# FUNCTION +# Writes the working (current) configuration to a file or a string. +# INPUTS +# * method -- used method. Possiable values are file (saving current congif +# to the file) and string (saving current config in a string) +# * dest -- destination used. File_id for files, and string name for string +# configurations +#**** proc dumpCfg {method dest} { global node_list link_list canvas_list @@ -127,6 +167,17 @@ proc dumpCfg {method dest} { return } +#****f* nodecfg.tcl/loadCfg +# NAME +# loadCfg -- loads the current configuration. +# SYNOPSIS +# loadCfg $cfg +# FUNCTION +# Loads the configuration written in the cfg string to a current +# configuration. +# INPUTS +# * cfg -- string containing the new working configuration. +#**** proc loadCfg { cfg } { global node_list link_list canvas_list @@ -191,7 +242,8 @@ proc loadCfg { cfg } { } network-config { set cfg "" - foreach zline [split $value { }] { + foreach zline [split $value { +}] { if { [string index "$zline" 0] == " " } { set zline [string replace "$zline" 0 0] } @@ -208,7 +260,8 @@ proc loadCfg { cfg } { } custom-config { set cfg "" - foreach zline [split $value { }] { + foreach zline [split $value { +}] { if { [string index "$zline" 0] == " " } { set zline [string replace "$zline" 0 0] } @@ -312,6 +365,23 @@ proc loadCfg { cfg } { return } +#****f* nodecfg.tcl/newObjectId +# NAME +# newObjectId -- new object Id +# SYNOPSIS +# set obj_id [newObjectId $type] +# FUNCTION +# Returns the Id for a new object of the defined type. Supported types +# are node, link and canvas. The Id is in the form $mark$number. $mark is the +# first letter of the given type and $number is the first available number to +# that can be used for id. +# INPUTS +# * type -- the type of the new object. Can be node, link or canvas. +# RESULT +# * obj_id -- object Id in the form $mark$number. $mark is the +# first letter of the given type and $number is the first available number to +# that can be used for id. +#**** proc newObjectId { type } { global node_list link_list canvas_list -- 2.39.5