Posted to tcl by aspect at Fri Sep 19 05:18:57 GMT 2014view raw

  1.  
  2. namespace eval macros {
  3. variable time
  4. proc tick {} {
  5. variable time
  6. incr time
  7. after 1000 ::macros::tick
  8. }
  9. proc schedule {} {
  10. after 1000 ::macros::tick
  11. foreach {interval message} {2000 run1 5000 run2} {
  12. after $interval [list ::macros::run $message]
  13. }
  14. }
  15. proc run {what} {
  16. variable time
  17. puts "Running $what at time $time"
  18. }
  19. }
  20.  
  21.  
  22.