You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by mx...@apache.org on 2007/10/14 17:22:24 UTC

svn commit: r584555 - in /tcl/rivet/trunk: ChangeLog rivet/rivet-tcl/load_response.tcl

Author: mxmanghi
Date: Sun Oct 14 08:22:23 2007
New Revision: 584555

URL: http://svn.apache.org/viewvc?rev=584555&view=rev
Log:
* rivet/rivet-tcl: new 'load_response.tcl'. This
version deals in a more consistent way with the case
of parameters that receive multiple values (see docs)


Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/rivet/rivet-tcl/load_response.tcl

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=584555&r1=584554&r2=584555&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Sun Oct 14 08:22:23 2007
@@ -1,3 +1,14 @@
+2007-10-14  Massimo Manghi <ma...@unipr.it>
+
+	* doc/rivet.xml: Front page updated, page for the
+	'load_response' command updated and extended, link to the 
+	Italian and Russian translations removed, html pages
+	in Italian and Russian removed from repository
+
+	* rivet/rivet-tcl: new 'load_response.tcl'. This
+	version deals in a more consistent way with the case
+	of parameters that receive multiple values (see docs)
+
 2007-10-12  David N. Welton  <da...@dedasys.com>
 
 	* doc/rivet.xml: Fixed "dio" id's.

Modified: tcl/rivet/trunk/rivet/rivet-tcl/load_response.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/rivet-tcl/load_response.tcl?rev=584555&r1=584554&r2=584555&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/rivet-tcl/load_response.tcl (original)
+++ tcl/rivet/trunk/rivet/rivet-tcl/load_response.tcl Sun Oct 14 08:22:23 2007
@@ -12,13 +12,17 @@
 proc load_response {{arrayName response}} {
     upvar 1 $arrayName response
 
-    array set response {}
-
     foreach {var elem} [var all] {
-        if {[info exists response($var)]} {
-            set response($var) [list $response($var) $elem]
-        } else {
-            set response($var) $elem
-        }
+	if {[info exists response(__$var)]} {
+		# we have seen var multiple times already, add to the list
+		lappend response($var) $elem
+	} elseif {[info exists response($var)]} {
+		# second occurence of var,  convert response(var) list:
+		set response($var) [list $response($var) $elem]
+		set response(__$var) ""
+	} else {
+		# first time seeing this var
+		set response($var) $elem
+	}
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org