• TCL procedure that runs in infinite loop until user presses key

    From Hassan Iqbal@21:1/5 to All on Tue Oct 12 15:32:58 2021
    I have a TCL terminal inside a program called "System Console". This is an add-on found with Intel Quartus Prime. In this I need to run a TCL procedure that once started, runs every 500 ms. This happens until a user presses a key at which point, it stops.

    Can this be done in TCL? If so, how?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From luocl@21:1/5 to Hassan Iqbal on Wed Oct 13 08:38:40 2021
    On 10/13/21 6:32 AM, Hassan Iqbal wrote:
    I have a TCL terminal inside a program called "System Console". This is an add-on found with Intel Quartus Prime. In this I need to run a TCL procedure that once started, runs every 500 ms. This happens until a user presses a key at which point, it
    stops.

    Can this be done in TCL? If so, how?


    first please reference https://wiki.tcl-lang.org/page/every to write "
    run a TCL procedure that once started, runs every 500 ms."

    second [fileevent stdin readable <commandToStopYourInfiniteLoop>]

    and then enter event loop for example [vwait forever]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bezoar@21:1/5 to luocl on Wed Oct 13 14:07:03 2021
    On Tuesday, October 12, 2021 at 7:38:48 PM UTC-5, luocl wrote:
    On 10/13/21 6:32 AM, Hassan Iqbal wrote:
    I have a TCL terminal inside a program called "System Console". This is an add-on found with Intel Quartus Prime. In this I need to run a TCL procedure that once started, runs every 500 ms. This happens until a user presses a key at which point, it
    stops.

    Can this be done in TCL? If so, how?

    first please reference https://wiki.tcl-lang.org/page/every to write "
    run a TCL procedure that once started, runs every 500 ms."
    second [fileevent stdin readable <commandToStopYourInfiniteLoop>]

    and then enter event loop for example [vwait forever]
    follow the script below

    proc runcommand { timeout args } {
    # your stuff here
    puts "runcommand $args"
    after $timeout [list runcommand $timeout {*}$args ]
    }

    set forever 0

    proc handleStdin { fd } {
    set char [ read $fd ]
    incr ::forever
    }

    fconfigure stdin -blocking 0 -buffering none
    fileevent stdin readable [list handleStdin stdin ]
    runcommand 3000 45 67 89
    vwait ::forever
    puts "all done"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)