# 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 {
}
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
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
}
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]
}
}
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]
}
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