Re: rebuilding expect with different timer



On 2006-07-04 16:54, Jeff Hobbs wrote:
James Harper XX (AS/EAB) wrote:

On 2006-07-04 08:00, Jeff Hobbs wrote:

Donal K. Fellows wrote:

James Harper XX (AS/EAB) wrote:

Has anybody rebuilt expect to do this and if so any help on where to
start would be useful.


[...]

The two areas that will require the different timing information are the
sleep command and handling timeouts.



There is a time virtualization API in Tcl 8.5's C interface. I don't
know how Expect handles time, but if it does it on top of Tcl's time
handling core, it should pick up the virtual times if you set them up.
But I'm not an expert on actually using the virtual time stuff, so I
can't offer detailed help.



Indeed, this is exactly why those APIs were introduced - to allow for Tcl and extensions built on Tcl that use Tcl_Time-based APIs to get a skewed sense of time. The time virtualization API should be fully sufficient for simulating both slower and faster time.


I have had a look at the expect source code and in particular expect.c, I believe the timeout handling code use the system function time(&time_t). However the sleep procedure uses Tcl_CreateTimerHandler, is this a procedure that can use the API's you talk about? We have Tcl8.4 installed and it might not be possible to upgrade to 8.5 for a while.


Which expect source base are you looking at? In conjunction with this patch to Tcl, Expect and TclX received patches to ensure that they use Tcl_Time-based handling everywhere.

Its 5.43
Our organisation uses Tcl 8.4 and expect 5.43 and as you can see from my email address we are quite a big organisation and changing which versions we use from the two mentioned will probably take a lot more time than implementing some code to use simulated times ;)
.



Relevant Pages

  • Re: rebuilding expect with different timer
    ... sleep command and handling timeouts. ... it should pick up the virtual times if you set them up. ... Tcl and extensions built on Tcl that use Tcl_Time-based APIs to get a skewed sense of time. ... The time virtualization API should be fully sufficient for simulating both slower and faster time. ...
    (comp.lang.tcl)
  • Re: rebuilding expect with different timer
    ... sleep command and handling timeouts. ... handling core, it should pick up the virtual times if you set them up. ... this is exactly why those APIs were introduced - to allow for Tcl and extensions built on Tcl that use Tcl_Time-based APIs to get a skewed sense of time. ... The time virtualization API should be fully sufficient for simulating both slower and faster time. ...
    (comp.lang.tcl)
  • Re: rebuilding expect with different timer
    ... sleep command and handling timeouts. ... handling core, it should pick up the virtual times if you set them up. ... this is exactly why those APIs were introduced - to allow for Tcl and extensions built on Tcl that use Tcl_Time-based APIs to get a skewed sense of time. ... The time virtualization API should be fully sufficient for simulating both slower and faster time. ...
    (comp.lang.tcl)
  • Re: ANNOUNCE: Colibri version 0.1
    ... At present there is no way at the script level to create such structures, so the current implementation is adequate from a pure Tcl point of view. ... One could think that such cyclic structures are not that frequent in real-world apps, ... The lack of cyclic structure handling is the reason why DOM trees cannot be implemented as plain Tcl objects but need a custom script-level object wrapper or a lower-level approach. ... But such low-level plumbing, while necessary, is not sufficient to properly handle cyclic data, as the script level enforces the contract that Everything Is A String. ...
    (comp.lang.tcl)
  • Re: File Descriptors
    ... At least one Tcl ... I think that depends somewhat one where you are coming to tcl/tk from. ... With regard to error handling in particular, ... Conditions under which exceptions occur ...
    (comp.lang.tcl)