anim.tcl

Go to the documentation of this file.
00001 /*  -*- tcl -*-*/
00002 /*  (C) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>*/
00003 /** 
00004  * ###
00005  */
00006 
00007 namespace ::sak::animate {}
00008 
00009 /*  ###*/
00010 
00011 ret  ::sak::animate::init () {
00012     variable prefix
00013     variable n      0
00014     variable max    [llength $prefix]
00015     variable extend 0
00016 }
00017 
00018 ret  ::sak::animate::next (type string) {
00019     variable prefix
00020     variable n
00021     variable max
00022     Extend string
00023 
00024     puts -nonewline stdout \r\[[lindex $prefix $n]\]\ $string
00025     flush           stdout
00026 
00027     incr n ; if {$n >= $max} {set n 0}
00028     return
00029 }
00030 
00031 ret  ::sak::animate::last (type string) {
00032     variable clear
00033     Extend string
00034 
00035     puts  stdout \r\[$clear\]\ $string
00036     flush stdout
00037     return
00038 }
00039 
00040 /*  ###*/
00041 
00042 ret  ::sak::animate::Extend (type sv) {
00043     variable extend
00044     upvar 1 $sv string
00045 
00046     set l [string length $string]
00047     while {[string length $string] < $extend} {append string " "}
00048     if {$l > $extend} {set extend $l}
00049     return
00050 }
00051 
00052 /*  ###*/
00053 
00054 namespace ::sak::animate {
00055     variable  prefix {
00056     {*   }  {*   }  {*   }  {*   }  {*   }
00057     { *  }  { *  }  { *  }  { *  }  { *  }
00058     {  * }  {  * }  {  * }  {  * }  {  * }
00059     {   *}  {   *}  {   *}  {   *}  {   *}
00060     {  * }  {  * }  {  * }  {  * }  {  * }
00061     { *  }  { *  }  { *  }  { *  }  { *  }
00062     }
00063     variable clear {    }
00064 }
00065 
00066 /** 
00067  * ###
00068  */
00069 
00070 package provide sak::animate 1.0
00071 

Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1