Re: calling "c" from TCL



On Feb 6, 10:16 am, Pablo <pablodecasti...@xxxxxxxxx> wrote:
On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@xxxxxxxxx>
wrote:









On Feb 5, 9:42 pm, Pablo <pablodecasti...@xxxxxxxxx> wrote:

Hello,

To sum vectors i wrote a code like this; it is receiving 3 vectors
data1, data2, data3. The diference between data1 and data2 is returned
with Tcl_SetObjResult, but i would like modify data3, how can i modify
data3??

Let the script level do that; just return the value:

  set data3 [vecsub $data1 $data2]

Unless you have strong reasons (like modifying more than one var),
there's no point in bringing to the C level the equivalent of [upvar].

-Alex

Thanks Alex, but the idea is modify more than one var, the script is
working like;

set result [vecsub $dat1 $dat2 $dat3], and i would like modify $result
(it is doing calling the procedure) and $dat3

You're not making it immediately obvious how this would modify several
variables...
Assuming you do it right (passing dat3 instead of $dat3, and
[upvar]ring it within the C function), what separate thing would the
function result hold ?

-Alex
.



Relevant Pages

  • Re: calling "c" from TCL
    ... with Tcl_SetObjResult, but i would like modify data3, how can i modify ... So, if you want to modify dat3, you'd ... I understand that "C" function transform dat3 in a variable for tcl, ...
    (comp.lang.tcl)
  • Re: calling "c" from TCL
    ... with Tcl_SetObjResult, but i would like modify data3, how can i modify ... So, if you want to modify dat3, you'd ... I understand that "C" function transform dat3 in a variable for tcl, ...
    (comp.lang.tcl)
  • Re: calling "c" from TCL
    ... with Tcl_SetObjResult, but i would like modify data3, how can i modify ... You can return *two* vectors (list of lists) and use ... lassign [vecsub $a $b] c d ...
    (comp.lang.tcl)
  • Re: calling "c" from TCL
    ... with Tcl_SetObjResult, but i would like modify data3, how can i modify ... than its value) to your command. ... So, if you want to modify dat3, you'd ...
    (comp.lang.tcl)
  • Re: calling "c" from TCL
    ... with Tcl_SetObjResult, but i would like modify data3, how can i modify ... You can return *two* vectors (list of lists) and use ... lassign [vecsub $a $b] c d ...
    (comp.lang.tcl)