Re: hai About Procedures
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: hai About Procedures

From: Bryan Oakley <oakley@bardo.clearlight.com>
Date: Tue Feb 28 2006 - 13:13:24 CET

gsumathi@gmail.com wrote:
> Hai ,
> Please clarify my doubt and send mail to me . My id is
> gsumathi@gmail.com
> I have one Tcl script , from this script i displayed all the procedure
> names and put that proc names into a list. Then if user given an input
> like 3 - 4 , i will display the all proc names from the list. But i
> want to execute the procedures . What is syntax for this ? Please send
> ur reply soon.

Assuming the name of a proc is in a variable, just do "eval $procname"

> If i given 3 - 10 , it will execute all the procedures from 3 to 10
> and also if the user input is 3 ,4 , it will execute the procs 3 and 4
> . If the user input is 4 , it will display the 4 th proc only .

off the top of my head, you'd do something like this (guaranteed not to
work, but it's probably pretty close):

   if {[regexp {([0-9]+) *- *([0-9]+)} $input -- start end]} {
     for {set i $start} {$i <= $end} {incr i} {
       set proc [<get proc $i>]
       eval $proc
     }
   }

>
> If anybody knows the coding ,please send it to me .
> Please send this as soon as possible.

Why don't you try solving the problem yourself then showing us what
you've done? We can then help you tune the code to get the result you
desire.
Received on Sun Apr 30 02:17:42 2006