]> git.entuzijast.net Git - imunes.git/commitdiff
source documentation for cfgparse.tcl
authorzrinka <zrinka>
Fri, 2 Dec 2005 10:36:26 +0000 (10:36 +0000)
committerzrinka <zrinka>
Fri, 2 Dec 2005 10:36:26 +0000 (10:36 +0000)
Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

cfgparse.tcl

index c994fbc2eec7cb6e8abebe87248f31b68facdabc..3dcdd03b163297206f15766ec71c6d10462d53ca 100755 (executable)
 # 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\r"
+           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 {\r}] {
+                           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 {\r}] {
+                           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