• tcl::chan::memchan and truncate

    From aotto1968@21:1/5 to All on Sat May 28 23:52:20 2022
    hi

    I replace some part of my code with tcl::chan::memchan and figure out
    that there is an error:

    error during truncate on "rc0": invalid argument
    while executing
    "chan truncate $FR 0"

    It seems that tcl::chan::memchan does NOT support truncate.
    but now I have a problem because I want to replace the
    entire memchan space with new data and the new data is !! shorter !!
    (in the example the FR is the tcl::chan::memchan)

    chan truncate $FR 0 → error!

    chan seek $FW 0
    chan seek $FR 0
    chan copy $FW $FR

    without "truncate" the FR has now extra lines at the end.

    question:

    1) can I add an EOF character at the end of FR ?
    2) is there an other way to "truncate" the memchan ?


    https://core.tcl-lang.org/tcllib/doc/tcllib-1-18/embedded/www/tcllib/files/modules/virtchannel_base/tcllib_memchan.html


    mfg AO

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aotto1968@21:1/5 to All on Sun May 29 09:53:28 2022
    On 28.05.22 23:52, aotto1968 wrote:
    ~~

    without "truncate" the FR has now extra lines at the end.

    question:

    1) can I add an EOF character at the end of FR ?
    2) is there an other way to "truncate" the memchan ?



    https://core.tcl-lang.org/tcllib/doc/tcllib-1-18/embedded/www/tcllib/files/modules/virtchannel_base/tcllib_memchan.html



    There is a workaround to use "tcl::chan::variable VARNAME" and on
    "trucate" to set this variable to ""

    → a lot of extra code required to simulate a missing "truncate"

    mfg.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Werner@21:1/5 to All on Sun May 29 09:02:22 2022
    There's already a ticket with a patch plus a branch with an implementation.
    For further information start at https://core.tcl-lang.org/tcllib/tktview/1985a342552755d5aa4c

    HTH,
    Christian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to [email protected] on Sun May 29 15:16:16 2022
    aotto1968 <[email protected]> wrote:
    On 28.05.22 23:52, aotto1968 wrote:
    ~~

    without "truncate" the FR has now extra lines at the end.

    https://core.tcl-lang.org/tcllib/doc/tcllib-1-18/embedded/www/tcllib/files/modules/virtchannel_base/tcllib_memchan.html

    There is a workaround to use "tcl::chan::variable VARNAME" and on
    "trucate" to set this variable to ""

    ? a lot of extra code required to simulate a missing "truncate"

    memchan is part of Tcllib, which means you have the full source.

    Fix the code to support truncate and submit a patch to the maintainer.

    Which is rather the point of open source, if something /you/ need is
    not present, /you/ have the ability to actually add it, fixing the
    issue for yourself, and everyone else who might need it in the future.

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