f



question about tcl/tk and c program

In my Tcl/Tk scripts, I want to program different branches according to
the result of my C extension procedures.
In the C procedure, we usually use such codes as follow:
int CountStart(ClientData clientData, Tcl_Interp *interp,int argc, char
*argv[])
{
...............
................
interp->result = "end vpstart.";
    	//return TCL_OK;
    	return TCL_ERROR;
}
In Tcl/Tk scripts, we can use "set ret [count_start $sym]" or
"catch {count_start $sym} ret" to call the C procedure CountStart.
The variable "ret" is assigned with the string which was saved in
"interp->result".
Now I want it can return 0 or 1 or 2 in the C procedure CountStart, and
then it can identify the result when call the c procedure in Tcl/Tk
scripts. I just want identify the number which is in the "return
...." sentence, not in the interp->="....".
How can I do this?

Best Regards
Guo

0
6/14/2005 7:19:16 AM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

3 Replies
694 Views

Similar Articles

[PageSpeed] 15

"sunnyboyGuo@gmail.com" <sunnyboyGuo@gmail.com> wrote:
# In my Tcl/Tk scripts, I want to program different branches according to
# the result of my C extension procedures.
# In the C procedure, we usually use such codes as follow:
# int CountStart(ClientData clientData, Tcl_Interp *interp,int argc, char
# *argv[])
# {
# ..............
# ...............
# interp->result = "end vpstart.";
#     	//return TCL_OK;
#     	return TCL_ERROR;
# }
# In Tcl/Tk scripts, we can use "set ret [count_start $sym]" or
# "catch {count_start $sym} ret" to call the C procedure CountStart.
# The variable "ret" is assigned with the string which was saved in
# "interp->result".
# Now I want it can return 0 or 1 or 2 in the C procedure CountStart, and
# then it can identify the result when call the c procedure in Tcl/Tk
# scripts. I just want identify the number which is in the "return
# ..." sentence, not in the interp->="....".
# How can I do this?

You can somewhat do that by
	set number [catch {statement}]
but I think Tcl sometimes changes the return code on you. You should stick to
only returning TCL_OK, TCL_ERROR, TCL_RETURN, TCL_BREAK, and TCL_CONTINUE.

It's better to set the interpretter value and use that on the return.
	Tcl_SetObjResult(interp,Tcl_NewIntObj(N));
	return TCL_OK;
then when you call it,
	set number [CountStart xyz]
that will set number to the integer N.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I love the smell of commerce in the morning.
0
wyrmwif (945)
6/14/2005 9:03:51 AM
sunnyboyGuo@gmail.com wrote:
> In my Tcl/Tk scripts, I want to program different branches according to
> the result of my C extension procedures.
> In the C procedure, we usually use such codes as follow:
> int CountStart(ClientData clientData, Tcl_Interp *interp,int argc, char
> *argv[])
> {
> ..............
> ...............
> interp->result = "end vpstart.";
>     	//return TCL_OK;
>     	return TCL_ERROR;
> }
> In Tcl/Tk scripts, we can use "set ret [count_start $sym]" or
> "catch {count_start $sym} ret" to call the C procedure CountStart.
> The variable "ret" is assigned with the string which was saved in
> "interp->result".
> Now I want it can return 0 or 1 or 2 in the C procedure CountStart, and
> then it can identify the result when call the c procedure in Tcl/Tk
> scripts. I just want identify the number which is in the "return
> ..." sentence, not in the interp->="....".
> How can I do this?

(1) Direct access to interp->result is deprecated (since Tcl8.0, IIRC) - 
please DO NOT USE IT in new code. It will stop working anytime now. Use 
the Tcl_Obj interfaces, or else the Tcl_SetResult string interface. 
Please see http://www.tcl.tk/man/tcl8.4/TclLib/SetResult.htm

(2) You can do 'set code [catch {count_start $sym} ret]'. This gives you 
both: the return code (the number in the "return ..." sentence) in 
$code, and the interp's result in $ret. If you do not care about $ret 
and only want $code, do 'set code [catch {count_start $sym}]'.

Miguel
0
msofer (298)
6/14/2005 11:11:48 AM
SM Ryan wrote:
> You can somewhat do that by
> 	set number [catch {statement}]
> but I think Tcl sometimes changes the return code on you. You should stick to
> only returning TCL_OK, TCL_ERROR, TCL_RETURN, TCL_BREAK, and TCL_CONTINUE.

Eh? If Tcl "changes the return code on you", it is a bug. If you have a 
real case, please do not fail to report it at sf's bugtracker 
(http://sourceforge.net/tracker/?group_id=10894&atid=110894)
0
msofer (298)
6/14/2005 11:16:34 AM
Reply:

Similar Artilces:

Opening a TCL program from within another TCL program in ANSYS Tcl-Tk
Hi everyone, I have been pulling my hair with this one for a couple of days and still have not found a fix. I'm working within ANSYS Tcl-Tk implementation. I created a Tcl-Tk script that generates a simple window with three buttons. Each button opens another window which is created in a separate Tcl file. The second window have a lot of text entries, variables, procedures, etc. I can open the second Tcl file by itself and everything works as supposed, but when I open it using the button in the first window, it opens but any procedure called by the widgets on the second window are not found... Here's the deal... Since I'm working within the ANSYS implementation of Tcl-Tk, I'm actually using an ANSYS command to open the second window. The command I use is: ### ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/ IBR_CAS.tcl' ### It actually sends a command back to ANSYS telling it to execute a Tcl command... I know this is not pretty but its the only way i was able to make it at least show the window. ############################## #Main Tcl (excerpt): ############################## namespace eval Tools { proc IBRCambpell {} { #source O:/mad_projects_2/ANSYS/Macros/IBR_CAS.tcl ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/ IBR_CAS.tcl' } proc viewManager {} { ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/ ViewManager.tcl' } proc powerAnnotation {} { ans_sendcommand ~eui,'source ...

question about compiling tcl/tk and c program
hello,everyone My ActiveTcl is installed in /home/myname/ActiveTcl. when I compile our tcl and c programs. I write a makefile and I set the -I and -L options as follows: -I~/ActiveTcl/include -L~/ActiveTcl/lib -ltcl8.4 -ltk8.4 after excute make command, the compile message as follows: /usr/bin/ld:cannot find -ltcl8.4 collect2: ld returned 1 exit status I code another small program, and use the follow command: gcc test.c -o test -I~ActiveTcl/include -I~/ActiveTcl/lib ~/ActiveTcl/lib/libtcl8.4.so it can compile successfully, but if use the follw command: gcc test.c -o test -I~ActiveTcl/include -I~/ActiveTcl/lib -ltcl8.4 it cannot find -ltcl8.4 what's wrong? I need your help. thank you very much. guo Hi Guo, guo writes: > gcc test.c -o test -I~ActiveTcl/include -I~/ActiveTcl/lib > ~/ActiveTcl/lib/libtcl8.4.so > it can compile successfully, but if use the follw command: > gcc test.c -o test -I~ActiveTcl/include -I~/ActiveTcl/lib > -ltcl8.4 > it cannot find -ltcl8.4 Short version: Use this instead: gcc -o test test.c \ -I$HOME/ActiveTcl/include \ -L$HOME/ActiveTcl/lib -ltcl8.4 Long version: "~" is a feature of the shell, just like "*" and "?". But "~" is only evaluated at the *start* of strings. So the shell will translate ~/something => $HOME/something => /home/guo/something (assuming that your home directory is "/home/guo"). But the shell will not touch -I~/Active...

Newbie to Tcl/Tk: Question about Tcl and VxWorks....
Hello All, I have tried looking on the offical tcl/tk website and also at WindRiver's without success. Please forgive my ignorance on this, but is tcl/tk available for VxWorks or is there in progress a port going on. Many thanks in advance, Richard "Richard Latter" <richard_l@latter.demon.co.uk> writes: > I have tried looking on the offical tcl/tk website and also at WindRiver's > without success. Please forgive my ignorance on this, but is tcl/tk > available for VxWorks or is there in progress a port going on. I have ancient Tcl 7.3 here, but don't know of newer ports. Donald Arseneau asnd@triumf.ca ...

E.J. Friedman-Hill's Tcl/Tk Course
E.J. Friedman-Hill's Tcl/Tk Course Tcl/Tk Programming in Five Easy Lessons http://www.linbox.com/ucome.rvt/any/doc_distrib/tcltk-8.3.2/TclCourse/ I am unable to open the ppt files that seem very promising. Can anyone see what is the problem with them and can convert/fix so that I can open in the office 2007 or open office ? Thanks Bolega On 24/03/2011 2:51 AM, bolega wrote: > E.J. Friedman-Hill's Tcl/Tk Course > Tcl/Tk Programming in Five Easy Lessons > > http://www.linbox.com/ucome.rvt/any/doc_distrib/tcltk-8.3.2/TclCourse/ > > I am unable to o...

a question about combining c++ and tcl/tk please?
Hi all, I am writing some simple code to test c++ with tcl/tk. myData class is trivial too. Compiling and linking the files, I got shared lib hello.so; I could not create an class object in the following code. ********************************** / * trycc.cpp: */ #include <stdio.h> #include <stdlib.h> #include <tcl.h> #include <tk.h> #include "myData.h" myData data1; /// not working here, could not load the package if have this line /// if I remove this line, then it worked fine. extern "C" int hello(ClientData data, Tcl_Interp* pInterp, int arc, const char* argv[]){ const char* mystr = "hello class"; Tcl_SetVar(pInterp, "tclvar", mystr,0); return TCL_OK; } extern "C" int Hello_Init(Tcl_Interp *interp){ Tcl_CreateCommand(interp, "hello", hello, NULL, NULL); return Tcl_PkgProvide(interp, "Hello", "1.0"); } Thanks a lot, Beet beet wrote: > Hi all, > > I am writing some simple code to test c++ with tcl/tk. myData class is > trivial too. > Compiling and linking the files, I got shared lib hello.so; I could not > create an class object in the following code. > > ********************************** > / * trycc.cpp: */ > #include <stdio.h> > #include <stdlib.h> > #include <tcl.h> > #include <tk.h> > #include "myData.h"...

create a tcl/tk interface for a c program
Hi, I have an application in c (a client for a news server). The application is working and running, the problem is that it is in command line mode. I want to create a separate tcl/tk interface that will control my c program; something like executing it, and reading the c-program results from the prompt and dealing with it... I need the two programs to be separated, and I don't need it to be a standalone program, I just need to launch the client from the tcl/tk interface and retrieve all messages in textbox or tables, and all the communication between the user and the c program would have to be through the tcl/tk interface. I am very familiar with programing in both languages, but I don't know where and how to start :) So I will be very thankfull if anyone can give me some advice or a link to any tutorial explaining how to do this. Thanks everyone Achraf In article <187af06a.0311182019.6a878c4d@posting.google.com>, Achraf El Youssoufi <991BE733792@stud.alakhawayn.ma> wrote: >Hi, > > I have an application in c (a client for a news server). The >application is working and running, the problem is that it is in >command line mode. I want to create a separate tcl/tk interface that >will control my c program; something like executing it, and reading >the c-program results from the prompt and dealing with it... > > I need the two programs to be separated, and I don't need it to be a >standalone program, I just...

[TCL/TK interface] Passing variable to TCL/TK
Hi, I am trying to sent to a variable to tcl/tk and unify there it with a string. I wrote the prolog code: :- use_module(library(tcltk)). :- use_package(classic). go(A):- tk_new([name('Simple')], Tcl), tcl_eval(Tcl, 'source simple2.tcl', _), tcl_eval(Tcl, ['ask', br(write(A))], _), tk_main_loop(Tcl), tcl_delete(Tcl). and the tcl file simple2.tcl proc ask {var} { unify_term $var my_value } unfortunatelly when I query for go(S). the interpeter goes into a loop (!?). Where I am wrong. Are there any example code somewhere i...

TCL/TCL combined with Java/C/C++, Any Recommendations?
Hi, I have an application that I wrote in TCL/TK. It has to work with big files +5GB. The parsing performace is not where I would like and some of the data manipulations are taking considerable amount of time due to the data size. Therefore I am considering switching these parts of the code to Java, C or C++. While keepting the GUI and GUI supporting code in TCL/TK at this time. I am trying to figure out which language will be easier to merge with TCL in an application. For C I know that I can compile and generate a .so or .dll and create a TCL package and load it. I believe this is done with SWIG but I have not done it. In Java I saw some info on Jacl and TclBlend. The application will be "compiled" into a TCL "executable". I know I can compile my TCL code into Byte code to protect the IP. I am not sure about Java. Any recommendations or pointers will be greatly appreciated. Thanks in advance, Frank Frank <kranfg@gmail.com> writes: > Hi, > > I have an application that I wrote in TCL/TK. It has to work with big files +5GB. > > The parsing performace is not where I would like and some of the data manipulations are taking considerable amount of time due to the data size. > > Therefore I am considering switching these parts of the code to Java, C or C++. While keepting the GUI and GUI supporting code in TCL/TK at this time. > > I am trying to figure out which language will be easier to ...

Problem in calling c programs and compiling them in tcl/tk
Hello, I have been assigned to open a directory with c programs in it using tcl/tk. Later I am supposed to c ompile all those c programs in that directory one after another using tclk/tk. I am able to open the directory and read all the c files. But when it comes to compiling them am not able to do it at all. I have tried using exec gcc filename.c and later exec ./a.out filename.c. For example , if i take helloworld.c program & write above 2 steps , its showing the o/p as "helloworld" . But it's also saying like child process exited abnormally. Please can one suggest a simple command to execute c programs . All the fork and thread concepts are quite new and confusing to me. Isn't there any simple command in tcl from which i can call a c program and compile it ? I have spent nearly 4 days about this problem.But no idea at all. Please if anyone can solve this , reply soon , if possible with an example . I am supposed to complete it with in 1 day more. Thanks in advance On 11 nov, 11:23, vasavi.n...@gmail.com wrote: > Hello, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 I have been assigned to open a direct= ory with c > programs in it using tcl/tk. Later I am supposed to c ompile all those > c programs in that directory one after another using tclk/tk. > I am able to open the directory and read all the c files. But when it > comes to compiling them am not able to do it at all. I have tried > using exec gcc filename.c and l...

Using Tcl/Tk as a user interface in a C program
Hi, i thought this question would come up every day, but i read this NG for a while and haven't seen it since. What i'd like to do is use Tcl/Tk in a standalone (linked against Tcl and/or Tk libs) C program. I'd like to open Windows and call Tcl scripts from C that handle the windows. I wouldn't like to have external scripts called, but i'd like to embed it in the C program. Has anybody got a short example for that (Linux / Windows)? Thanks for any hints, Torsten. MkTclApp is your friend: http://www.hwaci.com/sw/mktclapp/index.html Pretty simple, really. On Tue, 18 Nov 2003, Torsten Mohr wrote: > Date: Tue, 18 Nov 2003 20:05:35 +0100 > From: Torsten Mohr <tmohr@s.netic.de> > Newsgroups: comp.lang.tcl > Subject: Using Tcl/Tk as a user interface in a C program > > Hi, > > i thought this question would come up every day, but i read this > NG for a while and haven't seen it since. > > What i'd like to do is use Tcl/Tk in a standalone (linked against > Tcl and/or Tk libs) C program. > > I'd like to open Windows and call Tcl scripts from C that handle > the windows. I wouldn't like to have external scripts called, but > i'd like to embed it in the C program. > > Has anybody got a short example for that (Linux / Windows)? > > > Thanks for any hints, > Torsten. > > * Torsten Mohr <tmohr@s.netic.de> | I'd like to open Windows and call Tcl sc...

YouTube Playlist: Tcl/Tk Object Oriented Programming Using Itcl (incr Tcl) Lessons
Hi. Like I promised you hours ago.. The playlist in English : https://www.youtube.com/playlist?list=PLsAEIIjTPIo_1qeuc-rYwk0nxWAM38Dl_ The same playlist in Arabic : https://www.youtube.com/playlist?list=PLsAEIIjTPIo_91kA-iUz_5XGNmHzivHBG Enjoy! On Saturday, January 17, 2015 at 4:04:21 PM UTC+2, Rani Ahmad wrote: > Hi. > > Like I promised you hours ago.. > > The playlist in English : > > https://www.youtube.com/playlist?list=PLsAEIIjTPIo_1qeuc-rYwk0nxWAM38Dl_ > > The same playlist in Arabic : > > https://www.youtube.com/playli...

Design question, Tcl/Tk <=> C data ...
In managing database objects, I use C based list objects which are similar to the old style (int argc, char **argv) of Tcl arg passing, and in addition, a form of "tagged list" which corresponds pretty closely to Tcl associative arrays, where each of the array elements are lists of the above kind, referenced by a "string" tag rather than a numerical index. I need to be able to pass data back and forth between the C interface to the database manager, and Tcl/TK for CRUD operations, and while I'd like to minimize the copying of data insofar as possible, however, portability is an issue, and I'd prefer to use published API's rather than try to use Tcl's internal structs to avoid this (I'd like this code not to break post 8.5.0). A simple approach in the C -> Tcl direction would be to pass a string in the form of an array set {} command, but shimmering might be an issue in creating the Tcl object, and I'd still have to manually parse the array and re-create the tagged list on the C side for the return (Tcl ->C) trip. So I'm wondering ... should I simply bite the bullet and use the Tcl_NewByteArrayObj(3) and friends to pass the objects as an associative array of lists, or perhaps use the Tcl_NewDictObj(3) approach. Is there any efficiency to be gained by using dicts over associative arrays at this level (eg: conversion back and forth between C and Tcl)? Should I instead do something else entirely? Has an...

win32, link a C program against a static TCL/TK library
Hi everybody, i already received some hints here on how to generate a static TCL/TK library, it all worked fine. Also, i can now link my C program against that static library. The C program uses TCL/TK as an internal script language and at the moment just executes an example script that shows some buttons. It all works fine when i link my C program against a (dynamic) DLL. When i link it (unchanged) against a static LIB, it starts up, executes an internal script that shows some buttons, everything is drawn fine, but the buttons can't be pressed. The task manager says the program executes fine and i can close it by hitting the windows "close" button. But pressing the buttons that were generated from the internal script does not work. I don't know what goes wrong here, i haven't got a clue and i also don't know how to debug this or how to get closer to the problem. I've put the whole example project to this URL: http://www.s.netic.de/tmohr/c3.zip The example project needs the compiled Tcl and Tk sources with the static libs at: c:\home\tcl\tcl c:\home\tcl\tk It would be so very great if somebody could take a look at it to see where the problem could be. Kind regards, Torsten. Torsten Mohr <tmohr@s.netic.de> wrote: >It would be so very great if somebody could take a look at it >to see where the problem could be. are you running the event loop? Tk_MainLoop(); or while (1) { Tcl_DoOneEvent(TCL_ALL_EVENTS); } Hi, ...

l'C program executing from a tcl script with pipe opened using open command in Tcl
Hi all, I wanted to communicate with a C program from a Tcl script.. The test code i have written is below Both the 'C' program and Tcl script are located in the same directory. The 'C' program is below. I have named it CTCL.C #include<stdio.h> #include<string.h> int main() { int i; char c[30]; printf("Reading..."); scanf("%s",c); printf("String read is :%s\n",c); fflush(stdout); return 0; } I have compiled the program with the command cc CTCL.C -o ctcl So the executable was generated with the name 'ctcl' The Tcl script I have written is. I have named it TCLPIPETEST.tcl #!/usr/add-on/exptools/bin/tclsh set fd [open "|./ctcl" r+] gets $fd tmp1 puts "tmp1 = $tmp1" set stat 0 set tmp2 "Default value... " if { ![catch { puts $fd "abcdef" } res]} { if { ![catch { flush $fd } res] } { if { ![catch { gets $fd tmp2} res ] } { set stat 1 } else { puts "Error 'gets' from pipe : $res" } } else { puts "Error 'flush' from pipe:$res " } } else { puts "Error 'puts' from pipe:$res " } if { $stat == 1 } { puts "Success......:$tmp2 :)" } else { puts "Failure......:$tmp2 :(" } I have given all permissions for both the files above. When i execute the Tcl script My aim is to open a pipe with the 'C' executable 'ctcl', initially read so...

Extending TCL in C with tcl.h - Disabliing [<tcl-cmd>] feature
Hi, TCL has a command execution syntax like this: [<tcl cmd>] Anything inside the 3rd bracket will be executed as a Tcl command by the Tcl interprater. Is there any way I can disable/delete this Tcl construct [ <tcl-cmd>]? In other words, my Tcl interprator should print "[32]" for tcl command puts "[32]" It should not try to treat [] as a special character. Is this any way possible while extending Tcl in C with tcl.h? Thank you, Arijit * arijit79@gmail.com | puts "[32]" | | It should not try to treat [] as a special character. Check out the TCL quoting rules. http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm#M10 http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm#M15 Any of puts {[32]} puts "\[32\]" will do the trick. R' On May 8, 3:14 am, ariji...@gmail.com wrote: > Is there any way I can disable/delete this Tcl construct [ <tcl-cmd>]? By doing this, you would disable the primary functionality of Tcl. I'm certain you could go into the tcl source and stop it - but why not talk about what you are really trying to do. Perhaps someone can give you a better way of doing what you are wanting to do. ...

tcl as library of c/c++/java program
Hi, All tcl books I know talking how tcl can dynamically load c library. Is any source out there talking about WHO A C/C++/JAVA PROGRAM TO USE TCL AS LIBRARY? Thank, alex "tak" <tak416@yahoo.com> wrote > All tcl books I know talking how tcl can dynamically load c library. > Is any source out there talking about WHO A C/C++/JAVA > PROGRAM TO USE TCL AS LIBRARY? Start with http://phaseit.net/claird/comp.lang.tcl/HowToC.html but some people think that you can choose a better overall architecture. http://mini.net/tcl/9303 If you choose to use Tcl libraries "the o...

Connecting a C program with a tcl program with a socket
Dear readers, Several threads on this newsgroup mentioned communication between external programs and a tcl program, or controlling an external program with by a tcl program. In essence, the basic means to do this relatively gracefull is to open a socket (or pipe) connection between the two, and let them communicate over it using messages. Just for those who asked for it or with an interest, not in this case as well throughwrought result of many tests, but an example of how this principle can work in practice, at least it did for me, and did so long in the past, using no all to special means. First, two files to make a C program which at startup waits for a socket connection be established, and when it is connected it reads from the channel and repeates what it reads on the stdout. /* FILE: serv2.c */ /* server exa */ #include "cygwin/socket.h" #include "cygwin/in.h" #include <string.h> #define INMAX 1024 #define LINEMAX 10*1024 #define SERV_TCP_PORT 4100 int sockfd,newsockfd,clilen,childpid; struct sockaddr_in cli_addr, serv_addr; char in[INMAX], line[LINEMAX], rest[LINEMAX]; struct timeval timeout; fd_set fdvar; test_select() { int i; for (i=0; i<10; i++) printf ("select: %d\n",select(newsockfd,&fdvar,(fd_set *) 0, (fd_set *) 0, &timeout) ); } int do_read() { int rr, n, l, i,j; n = INMAX; FD_ZERO(&fdvar); FD_SET(newsockfd, &fdvar); /* printf ("select: %d\n&quo...

following tcl command execution from C/C++ code to tcl in gdb
Hi, We have a C/C++ huge application that makes heavy use of tcl C bindings. We frequently have very long stack traces from within gdb/dbx that look like this: #7 0x0d0aac7d in TclObjInterpProc (clientData=0x12857160, interp=0x10924df8, objc=6, objv=0x15138a40) at ../generic/tclProc.c:1146 #8 0x0d043dc6 in TclEvalObjvInternal (interp=0x10924df8, objc=6, objv=0x15138a40, command=0xe0c1382 "", length=0, flags=262144) at ../generic/tclBasic.c:3087 #9 0x0d044045 in Tcl_EvalObjv (interp=0x10924df8, objc=6, objv=0x15138a40, flags=262144) at ../generic/tclBasic.c:3203 This is just a very small part of what can be a very long stack trace. Now by poking around I can see that in gdb I can print *objv[0] to see the first word of a command but this is painful. What we really want is a way to see what Tcl commands are being executed either while the program is running or easily from the stack trace. Can you run gdb as well as a Tcl debugger at the same time? Seems unlikely. How are people systematically tracing the execution of Tcl commands that are called from C/++ bindings? Thanks. foobarbaz99@hotmail.com wrote: > How are people systematically tracing the execution of Tcl commands > that are called from C/++ bindings? Are you familiar with Tcl_CreateObjTrace() ? Does it accomplish what you need? -- | Don Porter Mathematical and Computational Sciences Division | | donald.porter@nist.gov Information Technology Laboratory | | http://mat...

Debugger for Tcl/Tk and [incr Tcl]
hi, where can i get Coverage for debugging tcl/tk, [incr Tcl] source? this tool is advised to use in 'Practical Programming in Tcl and Tk' or any other good debugger, which i could use? best, s. On Jan 23, 5:56=A0am, Sitaca <sit...@gmail.com> wrote: > hi, > > where can i get Coverage for debugging tcl/tk, [incr Tcl] source? > this tool is advised to use in 'Practical Programming in Tcl and Tk' > > or any other good debugger, which i could use? I see, at http://wiki.tcl.tk/8638 , a brief reference to the topic of coverage for tcl. I don't know whether or not any of the tools mentioned include coverage of itcl. On 23 jan, 12:52, "Larry W. Virden" <lvir...@gmail.com> wrote: > On Jan 23, 5:56=A0am, Sitaca <sit...@gmail.com> wrote: > > > hi, > > > where can i get Coverage for debugging tcl/tk, [incr Tcl] source? > > this tool is advised to use in 'Practical Programming in Tcl and Tk' > > > or any other good debugger, which i could use? > > I see, athttp://wiki.tcl.tk/8638, a brief reference to the topic of > coverage for tcl. I don't know whether or not any of the tools > mentioned include coverage of itcl. I have a more complete version of the coverage tool mentioned on that page. I just never got around to publishing it more widely. As for debuggers: the Wiki has a lot of pointers on that subject as well. Regards, Arjen Larry W. Virden wrote:...

C + Tcl/Tk
I'm a newbie of Tcl language and I would like to know how I could create a GUI in Tcl/Tk for a console program written in C, 'cause I'd like to write a platform indipendent Graphical application. I found out some helps from the "Load" page of ActiveTcl help on-line. Do you know further sites/references where I can find some stuff and help? Thanks in andvance for your replies. ffgg2005@tiscali.it wrote: > I'm a newbie of Tcl language and I would like to know how I could > create a GUI in Tcl/Tk for a console program written in C, 'cause I'd > like to write a platform indipendent Graphical application. > I found out some helps from the "Load" page of ActiveTcl help on-line. > Do you know further sites/references where I can find some stuff and > help? Hi, What exactly are you trying to do? Do you want to integrate Tcl with the program at the C level, or just make a "wrapper"? BTW, there is a tcl-italian mailing list, if you are interested - search for "tcl-italian" on google. Ciao, -- David N. Welton - http://www.dedasys.com/davidw/ Apache, Linux, Tcl Consulting - http://www.dedasys.com/ David N. Welton ha scritto: > ffgg2005@tiscali.it wrote: > > I'm a newbie of Tcl language and I would like to know how I could > > create a GUI in Tcl/Tk for a console program written in C, 'cause I'd > > like to write a platform indipendent Graphical application. > &...

Tcl/Tk from C
I want to write applications in C and create graphics/widgets/etc using Tcl/Tk library. I have no interest in programming Tcl/Tk except what is essential. Is there anywhere just one complete example of a C program that creates, say, a window containing a widget then obtaining input from that? Then I can work from that. At present I have an example that only creates an empty window, plus a huge amount of docs that tell me everything except how it all fits together. Thanks, Bart Bart C wrote: [...] If using C++ for your application isn't problem, then C++/Tk seems to be best choice: http://cpptk.sourceforge.net/ Else... I've no idea :) -- Pozdrawiam (Greetings)! Googie ...

Tcl + C question
If I create a C extension for my Tcl application would it be possible to craft it in such a way that non-Tcl programs can use it as a dynamic library also? I don't know much about C but...work makes me. Any pointers to docs or advice would be nice. : ) Robert Robert Hicks <sigzero@gmail.com> writes: > If I create a C extension for my Tcl application would it be possible > to craft it in such a way that non-Tcl programs can use it as a > dynamic library also? > > I don't know much about C but...work makes me. Write a library with a convenient C interface, then write a Tcl extension using that library. I doubt it would make sense to try and use the actual Tcl extension directly from C (without Tcl)---it's probably possible, but I'd guess it would be more trouble than it would be worth. At Wed, 11 Jul 2007 22:37:05 -0000 Robert Hicks <sigzero@gmail.com> wrote: > > If I create a C extension for my Tcl application would it be possible > to craft it in such a way that non-Tcl programs can use it as a > dynamic library also? > > I don't know much about C but...work makes me. > > Any pointers to docs or advice would be nice. : ) Write is as a normal C library. Then use the .h file that defines the public interface as the input to SWIG to create the Tcl interface. Include the SWIG generated .c module as part of the final shared library. The resultant .so file can now be either linked to C/C++ pro...

Tcl and C question
Hi, just for beginning my computer: Linux linux02 2.4.21-99-athlon #1 Wed Sep 24 13:34:32 UTC 2003 i686 athlon i386 GNU/Linux I have a double to string question. my HUGE_VAL is defined in the include-file /usr/include/bits/huge_val.h sourced by math.h . I want to convert this value into a string value but got only "inf" as result. After trying some tests I figure out that only the half value (0x1.0p1023) is represented correctly as string. I fought first this is on +/- issue but the definition of HUGE_VAL says +HUGE_VAL or -HUGE-VAL are valid numbers. the question is why is only the half size available? mfg aotto ...

Tcl-C question
I am creating a TCL interface for a library of C functions. The TCL interface commands need to be executed in a particular sequence; the first call will return a C pointer from underlying C layer which the Tcl script needs to store at its end and pass it as a parameter to the subsequent calls. What is the best way to pass this pointer back and forth? Do I need to pass it to the Tcl side after converting it to a string using sprintf and then call atoi at the C end to convert it back? Or is there a better way? Thanks in advance. Sabya This sounds like a good way to let scripts crash your library (by calling your APIs with bad pointer values). Your best bet is to assign some form of unique ID (that is not a memory pointer) to whatever it is you're pointing to, and return/pass that ID around, looking the ID up in an index as appropriate (maybe a hash table, maybe something else, depending on what's most efficient for your situation) to get the actual pointer. That way you can return an error if an API is given a non-existant ID, rather than blindly referencing a memory location that may not be valid. In article <3f77b8f1@news.cadence.com>, sabya_01@hotmail.com says... > I am creating a TCL interface for a library of C functions. The TCL > interface commands need to be executed in a particular sequence; the first > call will return a C pointer from underlying C layer which the Tcl script > needs to store at its end and pass it as a paramet...

Web resources about - question about tcl/tk and c program - comp.lang.tcl

German question - Wikipedia, the free encyclopedia
"Kleindeutschland" redirects here. For the neighborhood in New York City, see Little Germany, Manhattan . 1820 map of Central Europe showing ...

Nico Rosberg and Formula One's biggest question ... can he beat Hamilton?
Formula one's biggest question. Can Nico Rosberg beat Lewis Hamilton?

Experts question effectiveness of Xenophon's reforms to foreign investment laws
Nick Xenophon says current foreign investment laws are as clear as mud and weak as water.

Yahoo! Board Seats ‘Perplex’ SunTrust; ‘Fiduciary Duty’ in Question
SunTrust Robinson Humphrey ’s Robert Peck this morning follows up on the announcement by Yahoo! ( YHOO ) this morning that it has appointed two ...

I assume we're dealing with burst photography, so the question is: Why choose this particular instant ...
Everyone was just talking about that wonderful photograph that Christopher Horner captured at a Pittsburgh Pirates baseball game last Saturday. ...

Germanwings Crash Probe Questions Pilots' Medical Privacy Rights
Pilots with mental health issues shouldn’t enjoy the same privacy rights as other people because of the threat posed to passenger safety, according ...

Florida governor kicked off 'Morning Joe' after dodging questions about Trump's latest inflammatory statement ...
Florida Gov. Rick Scott was kicked off of MSNBC's "Morning Joe" on Thursday after he refused to directly answer a question about GOP frontrunner ...

Questions linger after mom says 4-year-old son shot her in truck
Questions linger after mom says 4-year-old son shot her in truck

‘Foolish and Impractical’: Security Experts Question Trump’s Mexico Wall Proposal
Donald Trump’s proposal to build a wall along the southwest border Mexico would decrease delicate bilateral border security cooperation, set ...

Wake up Texas. Houston. It's not a question of if. The question is when.
Willful passivity and political cowardice can be a real and present danger to our lives. Few of us in the Galveston/Houston area will ever forget ...

Resources last updated: 3/13/2016 5:37:25 PM