Index: hier-rtg-100.tcl
===================================================================
RCS file: /home/pmsrve/.cvsroot/ns_cims/tcl/ex/hier-rtg-100.tcl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hier-rtg-100.tcl	9 Oct 2003 18:59:11 -0000	1.1
+++ hier-rtg-100.tcl	21 Sep 2005 16:23:31 -0000	1.2
@@ -61,6 +61,46 @@
     exit 0
 }
 
+
+
+
+######## start pmsrve - pedro.estrela@gmail.com - 21/september/2005
+# this code will assign colors to the hierarchical nodes, based on the domain and cluster addresses.
+# each domain will have a distinct color (red, blue, green, magenta) and each cluster will have a certain shade of 
+# the domain's color
+#
+# this way, it will be easier to inspect in NAM the correct usage of hierarchical addresses.
+# 
+# NOTE: if you want to change the colors, check this simple TK program: http://wiki.tcl.tk/8606
+#
+
+set color_array {
+	red red4  maroon tomato
+	blue blue4 SteelBlue cyan 
+	green green4 SpringGreen4 seagreen2
+	magenta magenta3 orchid2 pink3
+}
+
+
+for {set i 0} { $i < [Node set nn_] } { incr i } {
+
+	set haddr [$n($i) set address_]
+	set L [AddrParams split-addrstr $haddr]
+	set domain [ lindex $L 0 ]
+	set cluster [ lindex $L 1 ]
+
+
+	set c [ lindex $color_array  [ expr $domain * 4 + $cluster ] ]
+	puts "Node $haddr -> $c"
+	
+	$n($i) color $c
+	$n($i) label "$haddr"
+}
+####### end pmsrve
+
+
+
+
 $ns run
 
 
