Re: how to invoke Tcl_DupInternalRepProc for testing
- From: "Alexandre Ferrieux" <alexandre.ferrieux@xxxxxxxxx>
- Date: 11 Apr 2007 13:49:11 -0700
On Apr 10, 10:20 am, "Anders Moe" <anders....@xxxxxxxxx> wrote:
I'm making my own types using Tcl_RegisterObjType and all that, which
includes assigning a Tcl_DupInternalRepProc function. Now, for testing
purposes I'd like to provoke Tcl into calling my Tcl_DupInternalRepProc
function, presumably as a result of some copying operation, but I'm not sure
how to do that. Can anyone help me here ?
Since Tcl has a copy-on-write mechanism, a mere "copy" like [set x $y]
is not enough. If you look for calls to the generic Tcl_DuplicateObj()
function (which in turn calls your type-specific dup), you'll see it
pretty hard-coded in the idiom "if (Tcl_IsShared(...)) ...
Tcl_DuplicateObj()" where in-place modification of data is about to
take place (lappend, linsert, lreplace, incr...). This of course is
unlikely to happen outside your type implementation (since only you
can know what in-place mod means for your intrep).
However, there's the debugging function "testobj", with subcommand
"duplicate".
Granted, this is more of an "in vitro" test...
HTH,
-Alex
.
- References:
- how to invoke Tcl_DupInternalRepProc for testing
- From: Anders Moe
- how to invoke Tcl_DupInternalRepProc for testing
- Prev by Date: Re: Newbie cross-compiling....
- Next by Date: ANNOUNCE: TclTalk 0.3.6.1
- Previous by thread: how to invoke Tcl_DupInternalRepProc for testing
- Next by thread: how to transfer mp3 files using sockets
- Index(es):
Relevant Pages
|