f



calling "c" from TCL

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??

Thanks

#include <tcl.h>
#include <iostream>
using namespace std;


int obj_vecsub(ClientData clientData, Tcl_Interp *interp, int argc,
Tcl_Obj *const objv[]);
int obj_vecsub(ClientData clientData, Tcl_Interp *interp, int argc,
Tcl_Obj *const objv[])

	{
	  if (argc != 3) {
	    Tcl_WrongNumArgs(interp, 1, objv, (char *)"?x? ?y?");
	    return TCL_ERROR;
	  }
	  int num1=0, num2=0, num3=0;
	  Tcl_Obj **data1, **data2, **data3;
	  if (Tcl_ListObjGetElements(interp, objv[1], &num1, &data1) !=
TCL_OK)
	    return TCL_ERROR;
	  if (Tcl_ListObjGetElements(interp, objv[2], &num2, &data2) !=
TCL_OK)
	    return TCL_ERROR;
	  if (Tcl_ListObjGetElements(interp, objv[3], &num2, &data3) !=
TCL_OK)
	    return TCL_ERROR;

	  if (num1 != num2) {
	    Tcl_SetResult(interp, (char *)"vecsub: two vectors don't have the
same size", TCL_STATIC);
	    return TCL_ERROR;
	  }

	  Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
	  Tcl_Obj *tcl_dummy = Tcl_NewListObj(0, NULL);
	  for (int i=0; i<num1; i++) {
	    double d1=0, d2=0, d3=77;
	    if (Tcl_GetDoubleFromObj(interp, data1[i], &d1) != TCL_OK) {
	      Tcl_SetResult(interp, (char *)"vecsub: non-numeric in first
argument", TCL_STATIC);
	      return TCL_ERROR;
	    }
	    if (Tcl_GetDoubleFromObj(interp, data2[i], &d2) != TCL_OK) {
	      Tcl_SetResult(interp, (char *)"vecsub: non-numeric in second
argument", TCL_STATIC);
	      return TCL_ERROR;
	    }
	    Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewDoubleObj(d1-
d2));
	    Tcl_ListObjAppendElement(interp, tcl_dummy,
Tcl_NewDoubleObj(d3));
	  }
	  Tcl_SetObjResult(interp, tcl_result);
	  return TCL_OK;
	}

//int AddObjCmd(ClientData clientData, Tcl_Interp *interp,int objc,
Tcl_Obj *CONST objv[]);

extern "C" {
int Add_Init(Tcl_Interp *interp) ;
} // end extern "C" *

int Add_Init(Tcl_Interp *interp) {
/* Register the Add command */
Tcl_CreateObjCommand(interp, "vecsub", obj_vecsub,(ClientData) NULL,
(Tcl_CmdDeleteProc *) NULL);

/* Declare the package */
Tcl_PkgProvide(interp, "vecsub", "1.1");
return TCL_OK;
}
0
2/5/2012 8:42:30 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

9 Replies
635 Views

Similar Articles

[PageSpeed] 9

On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> 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
0
2/5/2012 11:47:09 PM
On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
wrote:
> On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> 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:
>
> =A0 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

Thanks
0
2/6/2012 9:16:57 AM
On Feb 6, 2:16=A0am, Pablo <pablodecasti...@gmail.com> wrote:
> On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
> wrote:
>
>
>
>
>
>
>
>
>
> > On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> 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 returne=
d
> > > with Tcl_SetObjResult, but i would like modify data3, how can i modif=
y
> > > data3??
>
> > Let the script level do that; just return the value:
>
> > =A0 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
>
> Thanks

If you want to modify a variable, you need to pass its name (rather
than its value) to your command. So, if you want to modify dat3, you'd
call your command like this:

  set result [vecsub $dat1 $dat2 dat3]

If you need to get the value of the variable with that name, use
Tcl_ObjGetVar2. To set the variable, use Tcl_ObjSetVar2.
0
aric.bills (466)
2/6/2012 4:16:48 PM
On Feb 6, 10:16=A0am, Pablo <pablodecasti...@gmail.com> wrote:
> On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
> wrote:
>
>
>
>
>
>
>
>
>
> > On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> 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 returne=
d
> > > with Tcl_SetObjResult, but i would like modify data3, how can i modif=
y
> > > data3??
>
> > Let the script level do that; just return the value:
>
> > =A0 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
0
2/6/2012 8:40:44 PM
On 6 feb, 17:16, Aric Bills <aric.bi...@gmail.com> wrote:
> On Feb 6, 2:16=A0am, Pablo <pablodecasti...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
> > wrote:
>
> > > On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> 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 retur=
ned
> > > > with Tcl_SetObjResult, but i would like modify data3, how can i mod=
ify
> > > > data3??
>
> > > Let the script level do that; just return the value:
>
> > > =A0 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
>
> > Thanks
>
> If you want to modify a variable, you need to pass its name (rather
> than its value) to your command. So, if you want to modify dat3, you'd
> call your command like this:
>
> =A0 set result [vecsub $dat1 $dat2 dat3]
>
> If you need to get the value of the variable with that name, use
> Tcl_ObjGetVar2. To set the variable, use Tcl_ObjSetVar2.

Hi Aric,

I understand that "C" function transform dat3 in a variable for tcl,
is it?

0
2/7/2012 8:49:21 AM
On 7 feb, 09:49, Pablo <pablodecasti...@gmail.com> wrote:
> On 6 feb, 17:16, Aric Bills <aric.bi...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Feb 6, 2:16=A0am, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
> > > wrote:
>
> > > > On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > > > Hello,
>
> > > > > To sum vectors i wrote a code like this; it is receiving 3 vector=
s
> > > > > data1, data2, data3. The diference between data1 and data2 is ret=
urned
> > > > > with Tcl_SetObjResult, but i would like modify data3, how can i m=
odify
> > > > > data3??
>
> > > > Let the script level do that; just return the value:
>
> > > > =A0 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 [upva=
r].
>
> > > > -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 $resul=
t
> > > (it is doing calling the procedure) and $dat3
>
> > > Thanks
>
> > If you want to modify a variable, you need to pass its name (rather
> > than its value) to your command. So, if you want to modify dat3, you'd
> > call your command like this:
>
> > =A0 set result [vecsub $dat1 $dat2 dat3]
>
> > If you need to get the value of the variable with that name, use
> > Tcl_ObjGetVar2. To set the variable, use Tcl_ObjSetVar2.
>
> Hi Aric,
>
> I understand that "C" function transform dat3 in a variable for tcl,
> is it?

Thanks Aric,

It works perfectly, just i had to add to my "c" function:
Tcl_ObjSetVar2( interp, objv[3], NULL, tcl_dummy, TCL_LEAVE_ERR_MSG );

And calling the script with ;
set c [vecsub $a $b d]

it is giving me $c and $d with modified values.

0
2/7/2012 9:40:43 AM
On 7 feb, 09:49, Pablo <pablodecasti...@gmail.com> wrote:
> On 6 feb, 17:16, Aric Bills <aric.bi...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Feb 6, 2:16=A0am, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
> > > wrote:
>
> > > > On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > > > Hello,
>
> > > > > To sum vectors i wrote a code like this; it is receiving 3 vector=
s
> > > > > data1, data2, data3. The diference between data1 and data2 is ret=
urned
> > > > > with Tcl_SetObjResult, but i would like modify data3, how can i m=
odify
> > > > > data3??
>
> > > > Let the script level do that; just return the value:
>
> > > > =A0 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 [upva=
r].
>
> > > > -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 $resul=
t
> > > (it is doing calling the procedure) and $dat3
>
> > > Thanks
>
> > If you want to modify a variable, you need to pass its name (rather
> > than its value) to your command. So, if you want to modify dat3, you'd
> > call your command like this:
>
> > =A0 set result [vecsub $dat1 $dat2 dat3]
>
> > If you need to get the value of the variable with that name, use
> > Tcl_ObjGetVar2. To set the variable, use Tcl_ObjSetVar2.
>
> Hi Aric,
>
> I understand that "C" function transform dat3 in a variable for tcl,
> is it?

Thanks Aric,

Your point is working perfectly, just adding to "c" function;
Tcl_ObjSetVar2( interp, objv[3], NULL, tcl_dummy, TCL_LEAVE_ERR_MSG );
and calling the script :
set c [vecsub $a $b d]

it is giving me $c and $d with modify values
0
2/7/2012 9:43:47 AM
On 7 feb, 06:43, Pablo <pablodecasti...@gmail.com> wrote:
> On 7 feb, 09:49, Pablo <pablodecasti...@gmail.com> wrote:
>
>
>
> > On 6 feb, 17:16, Aric Bills <aric.bi...@gmail.com> wrote:
>
> > > On Feb 6, 2:16=A0am, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > > On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
> > > > wrote:
>
> > > > > On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > > > > Hello,
>
> > > > > > To sum vectors i wrote a code like this; it is receiving 3 vect=
ors
> > > > > > data1, data2, data3. The diference between data1 and data2 is r=
eturned
> > > > > > with Tcl_SetObjResult, but i would like modify data3, how can i=
 modify
> > > > > > data3??
>
> > > > > Let the script level do that; just return the value:
>
> > > > > =A0 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 [up=
var].
>
> > > > > -Alex
>
> > > > Thanks Alex, but the idea is modify more than one var, the script i=
s
> > > > working like;
>
> > > > set result [vecsub $dat1 $dat2 $dat3], and i would like modify $res=
ult
> > > > (it is doing calling the procedure) and $dat3
>
> > > > Thanks
>
> > > If you want to modify a variable, you need to pass its name (rather
> > > than its value) to your command. So, if you want to modify dat3, you'=
d
> > > call your command like this:
>
> > > =A0 set result [vecsub $dat1 $dat2 dat3]
>
> > > If you need to get the value of the variable with that name, use
> > > Tcl_ObjGetVar2. To set the variable, use Tcl_ObjSetVar2.
>
> > Hi Aric,
>
> > I understand that "C" function transform dat3 in a variable for tcl,
> > is it?
>
> Thanks Aric,
>
> Your point is working perfectly, just adding to "c" function;
> Tcl_ObjSetVar2( interp, objv[3], NULL, tcl_dummy, TCL_LEAVE_ERR_MSG );
> and calling the script :
> set c [vecsub $a $b d]
>
> it is giving me $c and $d with modify values

Two things worth noting:

1) You can return *two* vectors (list of lists) and use

lassign [vecsub $a $b] c d

and avoid accessing the variable from the C side.

2) your code is leaky; more specifically, you are not managing
Tcl_Obj's
reference count properly. Consider what happens with both tcl_result
and
tcl_dummy variables if Tcl_GetDoubleFromObj() fails.
See http://wiki.tcl.tk/1192 and http://wiki.tcl.tk/14880 for a
discussion
on this subject.

Regards
Emiliano
0
2/7/2012 4:23:59 PM
On 7 feb, 17:23, Emiliano <emilianogavi...@gmail.com> wrote:
> On 7 feb, 06:43, Pablo <pablodecasti...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On 7 feb, 09:49, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > On 6 feb, 17:16, Aric Bills <aric.bi...@gmail.com> wrote:
>
> > > > On Feb 6, 2:16=A0am, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > > > On 6 feb, 00:47, Alexandre Ferrieux <alexandre.ferri...@gmail.com=
>
> > > > > wrote:
>
> > > > > > On Feb 5, 9:42=A0pm, Pablo <pablodecasti...@gmail.com> wrote:
>
> > > > > > > Hello,
>
> > > > > > > To sum vectors i wrote a code like this; it is receiving 3 ve=
ctors
> > > > > > > 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:
>
> > > > > > =A0 set data3 [vecsub $data1 $data2]
>
> > > > > > Unless you have strong reasons (like modifying more than one va=
r),
> > > > > > 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 $r=
esult
> > > > > (it is doing calling the procedure) and $dat3
>
> > > > > Thanks
>
> > > > If you want to modify a variable, you need to pass its name (rather
> > > > than its value) to your command. So, if you want to modify dat3, yo=
u'd
> > > > call your command like this:
>
> > > > =A0 set result [vecsub $dat1 $dat2 dat3]
>
> > > > If you need to get the value of the variable with that name, use
> > > > Tcl_ObjGetVar2. To set the variable, use Tcl_ObjSetVar2.
>
> > > Hi Aric,
>
> > > I understand that "C" function transform dat3 in a variable for tcl,
> > > is it?
>
> > Thanks Aric,
>
> > Your point is working perfectly, just adding to "c" function;
> > Tcl_ObjSetVar2( interp, objv[3], NULL, tcl_dummy, TCL_LEAVE_ERR_MSG );
> > and calling the script :
> > set c [vecsub $a $b d]
>
> > it is giving me $c and $d with modify values
>
> Two things worth noting:
>
> 1) You can return *two* vectors (list of lists) and use
>
> lassign [vecsub $a $b] c d
>
> and avoid accessing the variable from the C side.
>
> 2) your code is leaky; more specifically, you are not managing
> Tcl_Obj's
> reference count properly. Consider what happens with both tcl_result
> and
> tcl_dummy variables if Tcl_GetDoubleFromObj() fails.
> Seehttp://wiki.tcl.tk/1192andhttp://wiki.tcl.tk/14880for a
> discussion
> on this subject.
>
> Regards
> Emiliano

Thanks Emiliano,

your point 1) is very useful.

Pablo
0
2/8/2012 4:43:31 PM
Reply:

Similar Artilces:

["a", "b", "c", "d"] to "a, b, c, d"?
I want to process each element of an array, but the last element should be handled special. Here is an example: def p_ary(ary) str = "" ary.each do |elem| str << elem << ", " end str.chomp!(", ") str end so p_ary(["a", "f", "x", "test"]) produces "a, f, x, test". The code works, but isn't there an easier and more general way for this behaviour? martinus On Tue, 06 Apr 2004 04:23:22 -0700, Martin wrote: > I want to process each element of an array, but the last ele...

"""""""""ADD ME""""""""""
Hi , Hope you are doing great. Please let me take this opportunity to introduce myself, Iam Karthik working with BhanInfoi Inc, a NY based company. We have consultants on our bench on various technologies, my request is to add me to your distribution list and kindly do send me the requirements. i have the below list available 1. Mainframe 2. Java 3.. Financial Analyst 4. Data Architect If there is any vendor ship agreement which has to be signed then I would like to take an opportunity to represent my company and expect your cooperation... ...

What does "Standard C", "K&R C" , "ANSI C" mean?
I am just wondering what the following terms usually mean: 1) "Standard C" 2) "K&R C" 3) "ANSI C" I am pretty sure "ANSI C" usually refers to the C89 standard, but what about the other two? What is the "saying" for C99 standard? Thank you On 17 Jan 2005 21:26:42 -0800, "Luke Wu" <LookSkywalker@gmail.com> wrote in comp.lang.c: > I am just wondering what the following terms usually mean: > > 1) "Standard C" The current version of the C language standard. This is now known as "ISO/IEC 9899:19...

"my" and "our"
Hi, while testing a program, I erroneously declared the same variable twice within a block, the first time with "my", the second time with "our": { my $fz = 'VTX_Link'; .... ( around 200 lines of code, all in the same block) our $fz = 'VTX_Linkset'; ... } So the initial contents of the $fz declared with "my" is lost, because "our" creates a lexical alias for the global $fz, thus overwriting the previous "my" declaration. It was my error, no question. But I wonder why Perl doesn't mention this - even with "use s...

"or" and "and"
Hi, I'm just getting to discover ruby, but I find it very nice programming language. I just still don't understand how the "or" and "and" in ruby... I was playing with ruby and for example made a def to print Stem and Leaf plot (for those who didn't have a statistics course or slept on it, e.g. http://cnx.org/content/m10157/latest/) Here is the Beta version of it: class Array def n ; self.size ; end def stem_and_leaf(st = 1) # if st != (2 or 5 or 10) then ; st = 1 ; end k = Hash.new(0) self.each {|x| k[x.to_f] += 1 } k = k.sort{|a, b| a[0].to_f <=&g...

"/a" is not "/a" ?
Hi everybody, while testing a module today I stumbled on something that I can work around but I don't quite understand. >>> a = "a" >>> b = "a" >>> a == b True >>> a is b True >>> c = "/a" >>> d = "/a" >>> c == d True # all good so far >>> c is d False # eeeeek! Why c and d point to two different objects with an identical string content rather than the same object? Manu Emanuele D'Arrigo wrote: >>>> c = "/a" >>>&...

"out" and "in out"
Hi i found the following explaination: In Ada, "in" parameters are similar to C++ const parameters. They are effectively read-only within the scope of the called subprogram. Ada "in out" parameters have a reliable initial value (that passed in from the calling subprogram) and may be modified within the scope of the called procedure. Ada "out" parameters have no reliable initial value, but are expected to be assigned a value within the called procedure. What does "have no reliable initial value" mean when considering the "out" parameter? By c...

about "++" and "--"
why this program snippet display "8,7,7,8,-7,-8" the program is: main() { int i=8; printf("%d\n%d\n%d\n%d\n%d\n%d\n",++i,--i,i++,i--,-i++,-i--); } > why this program snippet display "8,7,7,8,-7,-8" Ask your compiler-vendor because this result is IMHO implementation-defined. Check this out: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.15 http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.16 Regards, Irina Marudina fxc123@gmail.com wrote: > why this program snippet display "8,7,7,8,-7,-8&q...

why "::", not "."
Why does the method of modules use a dot, and the constants a double colon? e.g. Math::PI and Math.cos -- Posted via http://www.ruby-forum.com/. On Oct 26, 2010, at 01:48 , Oleg Igor wrote: > Why does the method of modules use a dot, and the constants a double > colon? > e.g. > Math::PI and Math.cos For the same reason why inner-classes/modules use double colon, because = they're constants and that's how you look up via constant namespace. Math::PI and ActiveRecord::Base are the same type of lookup... it is = just that Base is a module and PI is a float....

How to do PHP "require()" or TCL "source" in bash script
I'm sorry but I can't figure out how to explain this any better than this. In PHP we have a command "require()" that obtains a file and logically places it into another file. I cannot figure out how to do this in bash script as the requirement is necessary for a migration script to obtain the code from a .cfg file and then be able for the "parent" script to run the code it "imported" from the .cfg file, much like PHP's require() or TCL's "source". This is what I have so far and it fails: if [ -f ivc.cfg ]; then cat ivc.cfg fi Anyone...

How to replace the "\" in "C:\myrootr\folder" with "/" ?
Hi, Can someone help me. I know this should be easy but I coulnt get it working. I want to replace the "\" backslash character in a string e.g: my $test = "C:\myroot\folder"; with forward slash "/" This is what my snippet, which seems to be not doing anything.... $test =~ s|\|/|g; <sv2021@gmail.com> wrote in message news:1182879493.083400.174080@m37g2000prh.googlegroups.com... > Hi, > Can someone help me. I know this should be easy but I coulnt get it > working. > > I want to replace the "\" backslash character in a string e.g...

Does it need a ";" at the very after of "if" and "for"
write code like: int main(void) { int a=10; if(a<20) {} } Compiler ok on dev-cpp . don't we have to add a ";" after if statement? marsarden said: > write code like: > > int main(void) > { > int a=10; > if(a<20) > {} > } > > Compiler ok on dev-cpp . don't we have to add a ";" after if > statement? The syntax for 'if' is: if(expression) statement There is no semicolon after the ) but before the statement. The statement is either a normal statement (which can be empty), ending in a semicolon:- if(expr) ...

"In" "Out" and "Trash"
I just bought a new computer and I re-installed Eudora Light on my new computer. But when I open Eudora, the "In", "Out" and "Trash" links are not on the left side of the screen the way they were on my old computer. How can I get these links back on the left side of the screen? Thank you. On 25 Mar 2007 09:49:22 -0700, "abx" <abfunex@yahoo.com> wrote: >I just bought a new computer and I re-installed Eudora Light on my new >computer. But when I open Eudora, the "In", "Out" and "Trash" links >are ...

Looking for binary "expect" and "TCL/Tk" (if required) for OpenServer6
Does anybody know where to find "expect" (and related requirements) for OpenServer6? I can download the source files from nist.gov, but they do not compile. The MAN pages are already loaded on the system, so I suspect the programs would be on the distribution media somewhere. Any help would be appreciated. Thanks, Rick On 9 Feb, 17:57, Rick_Hoyle <motosl...@hotmail.com> wrote: > Does anybody know where to find "expect" (and related requirements) > for OpenServer6? I can download the source files from nist.gov, but > they do not compile. The MAN pages are al...

Windows "C" vs TCL sockets
Under windows 2000, I have a client server pair written in C that use the winsock library. I also have a client server pair written in TCL. The "C" pair happily communicate with one another. Likewise the TCL pair happily communicate with one another. My problem is that the "C" sockets are not able to connect with the TCL sockets. Is there a fundamental difference between TCL sockets and sockets created via a windows program or should I continue to stare at my code? The windows documentation talks about stream vs datagram sockets. Could that be the difference? "Pa...

"exceptional c++", "c++ template programming"
Hello, I am looking for an example of a constructor, I think, which took the type itself for integral or floating types, and a const-ref for a user-defined non primitive type. I saw this in one of these books but I can't find it now: "Exceptional C++" "Exceptional C++ Style" "C++ template programming MPL" if anyone remembers this passage for these books? I found it. It was the MPL book, right before 4.1.2 "Hicham Mouline" <hicham@mouline.org> wrote in message news:49228a87$0$90275$14726298@news.sunsite.dk... > Hello, > I am loo...

What is the difference between "Borland C++" and "Turbo C++"?
...

File::Find calls "wanted" before calling "preprocess"
File::Find always calls "wanted" with "." before calling preprocess for the first directory. I can work around it, but it doesn't seem right: the docs say "Your preprocessing function is called after readdir(), but before the loop that calls the wanted() function." Or is there a subtle reason why find calls "wanted" with ".", before letting preprocess change the list of entries, which I should be appreciating? A simple program illustrating the order of calls- #!/usr/bin/perl use File::Find; sub wanted { print " I found entry $_\n&qu...

"Stacks" should be called "Piles"
LOL! This is one pissed off Mactard!!! http://www.davidillig.com/whatamess.shtml ""Piles" Might be a Better Name "Stacks" are the worst idea I have ever seen in a GUI. The ability to place a folder in the Dock and right-click to see its contents in an easy-to-read, alphabetized list was powerful. I can no longer do that. See this abomination at <http://www.davidillig.com/whatamess.shtml>. Display as a grid, you say. Marginally better. I still can't hold the right button and see the contents of sub-folders. If Apple stole "Stacks" from Microsoft they must have gotten it out of the dumpster. It's not even good enough for Windows. Davoud" This guys is SOOOOOO out of the Church of Jobs. Jim and Alan might hunt him down and lynch him for heresy!!! "MuahMan" <muahman@cumcast.net> wrote in message news:DoCdnXH3rv61bLXanZ2dnUVZ_hKdnZ2d@comcast.com... > LOL! > > This is one pissed off Mactard!!! > > http://www.davidillig.com/whatamess.shtml > > ""Piles" Might be a Better Name > > "Stacks" are the worst idea I have ever seen in a GUI. The ability to > place a folder in the Dock and right-click to see its contents in an > easy-to-read, alphabetized list was powerful. I can no longer do that. > > See this abomination at <http://www.davidillig.com/whatamess.shtml>. > Display as a grid, you say. Marginally better. I still can't hol...

dolby "B", "C"
I've got some old cassettes with unique and original recordings that I'de like to move onto computer. They were recorded with Dolby B. Some were recorded with dolby C. I'de like to transfer the tapes to computer and then "decode" the dolby on the wav files after. My understanding is that since dolby is an analog system, it should be simple to emulate it. I already have a feeling that an expander and a low pass filter (whose strength would follow the loudness contour of the audio) might be the way to go. Any thoughts? Just curious, why do you want to do it this w...

"Vectors" in tcl?
Hi all, What is my "best" alternative in handling vectors in Tcl? ("best" as in using a package available in ActiveTcl. I know about VecTcl, but...) I want to use a vector (potentially large, as in half a million boolean values). If this vector is created with all zeros, and I want to turn some of them (I have their indices as a tcl list) to 1. Right now I am using a tcl list, but I need to loop over this list, and set each one to 1. And I was wondering if there is a faster way (as in doing it with a single tcl command). I was looking at the the math:...

"?" in Tcl regexp
Any one can explain why I can not match the character "?" in Expect: expect -re "bala bala\?" Thanks, Dao "Dao" <youdao_du@hotmial.com> wrote in message news:bgt790$aca$1@zcars0v6.ca.nortel.com... > Any one can explain why I can not match the character "?" in Expect: > expect -re "bala bala\?" Backslash substitution in the quoted string is taking away the backslash for you; so the regexp you are using is "bala bala?" Put the string in braces instead of quotes. -- Jonathan Bromley, Consultant DOULOS - Developing De...

In HTML spec,are "href" and "style" called "attribute"?....@@
regards: <a href="JavaScript:loadwindow(106,90);" style="font-family:Verdana;">&#20803;&#26234;Intranet</a> In HTML spec,are "href" and "style" called "attribute"?....@@ Could someone good give me the hand? @@. thank you may god be with you On 29 Jan 2005 10:14:38 -0800, mike <s917124@mail.yzu.edu.tw> wrote: > regards: > > <a href="JavaScript:loadwindow(106,90);" > style="font-family:Verdana;">&#20803;&#26234;Intranet</a> > > In HTML spec,...

What's wrong with strcpy/strcat in this "C for Tcl" experiment?
L.S. I'm doing some exercises in C for Tcl (still learning C). One thing I don't understand is why strcpy or strcat cause a segfault when loading the C-extension (see code below) into tclsh. When using the same calls to strcpy and strcat in a stand alone executable (not linked to Tcl), I do not stumble into this problem. Apparently, there is something wrong with the way that I combine these fuctions with Tcl. Could somebody please explain why strcpy or strcat cause problems in my code ? I've been using gcc on Linux and tcl8.4.5 Thanks in advance, Erik Leunissen ===========...

Web resources about - calling "c" from TCL - comp.lang.tcl

Resources last updated: 3/13/2016 10:20:44 AM