f



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
0
11/19/2003 4:19:33 AM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

5 Replies
788 Views

Similar Articles

[PageSpeed] 23

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 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.
			.
			.
			.
We have many, many examples.  Does <URL: http://
www.itworld.com/AppDev/4061/swol-1218-regex/ >
help?
-- 

Cameron Laird <claird@phaseit.net>
Business:  http://www.Phaseit.net
0
claird429 (924)
11/19/2003 4:34:23 AM
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 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.
			.
			.
			.
<URL: http://wiki.tcl.tk/WrappingExternalCommands >
-- 

Cameron Laird <claird@phaseit.net>
Business:  http://www.Phaseit.net
0
claird429 (924)
11/19/2003 4:39:05 AM
claird@lairds.com (Cameron Laird) wrote in message news:<vrlsv928jsrib2@corp.supernews.com>...
> 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 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.
> 			.
> 			.
> 			.
> <URL: http://wiki.tcl.tk/WrappingExternalCommands >


  Thank you for the websites, it is already helping me.  Still if some
one else can provide some more help, it would be great, because my
program is very complicated in input and output.

Thanx again.
0
11/19/2003 2:15:09 PM
Achraf El Youssoufi wrote:
> 

>   Thank you for the websites, it is already helping me.  Still if some
> one else can provide some more help, it would be great, because my
> program is very complicated in input and output.
> 
> Thanx again.

If you post specific questions, we will be glad to help out. Oh, may
I interest you in my Poor Man's GUI? <http://wiki.tcl.tk/4326>, the full
code is available via CANTCL (<http://wiki.tcl.tk/cantcl>

Regards,

Arjen
0
arjen.markus (2628)
11/19/2003 2:18:01 PM

Arjen Markus wrote:

> Achraf El Youssoufi wrote:
> 
> 
>>  Thank you for the websites, it is already helping me.  Still if some
>>one else can provide some more help, it would be great, because my
>>program is very complicated in input and output.
>>
>>Thanx again.
> 
> 
> If you post specific questions, we will be glad to help out.

Speak for yourself...

I wrote somewhere on another thread that I promised to look into (again) 
linking a C program with a tcl/tk program over sockets, that maybe not a 
simple approach, but it is bearable, and rather powerfull. I'll put in 
on the wiki when I have found opportunity for *that*.

In a way of course, that's the way X servers/clients work, for very long 
already..

    Theo

0
theover (24)
11/19/2003 3:10:10 PM
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 ...

[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...

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

Tcl interface to C program
I am developing a program (a game) that has two main states: one is the actual game which is a low-level full screen C program that must be very optimized; the other is a textual interface where the player sets options like difficulty, save games, colors, etc. For example, while playing the game the user can press Esc to pause the game and go into the text interface. I was thinking of using Tcl as the text interface. Does anyone have any pointers on how to do this? I would like to design it so the main() part of the program is Tcl, with a command lets the user switch into the full screen C game (which would be like a module). How does that work? Can it all be combined into one executable file? Any help would be appreciated. bluejolts@gmail.com schrieb: > I am developing a program (a game) that has two main states: one is > the actual game which is a low-level full screen C program that must > be very optimized; the other is a textual interface where the player > sets options like difficulty, save games, colors, etc. For example, > while playing the game the user can press Esc to pause the game and go > into the text interface. text interface aka tty on unix or dos console on windows? Another option would be to use Tk for a gui. > > I was thinking of using Tcl as the text interface. Does anyone have > any pointers on how to do this? For tty's look at the tcllib term package, which does ansi escape sequences and cursor movement stuff in ansi...

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

how to access prolog from tcl?(not using tcl/tk interface from prolog)
hi, I am now doing my thesis project relate to mobile agent technology which need to access prolog from tcl. There are a lot of prologs which have the function to access tcl from prolog, but I need to access prolog from tcl.(I can not use the method that first load prolog, then access tcl via the interface, and reload prolog). So is there any one can help me or give me some tips to solve this problem? Now I can only found one article to solve this problem(http://tkoutline.sourceforge.net/wiki/38). I tried the code, but unfortunately, the terminal always crashed and did not give any response when I run the second command of its example---"% prolog::init". I could run the command of "plcon -s interp.pl -t main -q" in DOS terminal without problem. Originally I thought it is the version problem of tcl, so I changed it from 8.4.9 to 8.0.3, but the problem was still there. My SWI-prolog version is 3.1.2. My operating system is winXP. I am now very nervous about that, Please give me some help to solve this problem, or tell me some other way to access prolog from tcl. Thank you very much I did not give up the solution of (http://tkoutline.sourceforge.net/wiki/38). Now I changed SWI-prolog version to 5.4.4. When I run the second command(prolog::init) of the example from wish.exe, it pop up a window, said that Prolog interpreter closed unexpectedly Prolog interpreter closed unexpectedly while executing "error "Prolog interpreter closed unexpect...

C++/Tcl/C++ Interface
Hi, I'm a newbie in Tcl and Tcl/C++ interfacing. I need to develop a prototype for one of our upcoming project. I've a shared library which provides Tcl procedures to traverse through some graph which is being created upon reading a file of specific format. If I load this shared library in Tcl shell and call those proc to read the specific file and traverse the graph. Graph traversal proc are like: * getting neighbor nodes of a given node * getting the node name and edge names to/from a node Let's name this Tcl library GL (graph lib). Now, in my C++ program I need create a duplicate graph since I don't have capability read that file directly. So from my C++ code, I need to create a Tcl channel, send commands through the Tcl channel for GL procs and get information from those GL procs to my C++ application to build a duplicate graph on my end. Could some one provide hints how to go about this? Any pointers to existing resource (doc/open source code) will be very helpful. Please redirect me to correct group if this is not the most appropriate one. Regards, ~ Soumen Soumen wrote: > Hi, > > I'm a newbie in Tcl and Tcl/C++ interfacing. I need to develop a > prototype for one > of our upcoming project. > > I've a shared library which provides Tcl procedures to traverse > through some graph > which is being created upon reading a file of specific format. If I > load this shared > library in Tcl shell and ca...

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 "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 # "...

tcl-mmap: A POSIX mmap interface for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mmap Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides a Tcl package that allows Tcl scripts to: 1) Memory map files for improved access efficiency; 2) Share memory between related processes; 3) Easily implement cyclic persistent log files. * See the mmap(2) man page. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-mmap/ Man page: http://tcl-mmap.sourceforge.net/ Author: Alexandros Stergiakis On Sep 3, 11:48=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl project: tcl-mmap > > Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides > a Tcl package that allows Tcl scripts to: 1) Memory map files for > improved access efficiency; 2) Share memory between related processes; > 3) Easily implement cyclic persistent log files. > > * See the mmap(2) man page. > Great to see this and the other packages you made. Looking at the manpage it looks a bit misformatted before the usage example. Any specific reason to use GPL for this instead the usual Tcl/MIT/BSD style license used? Michael schlenk wrote: > On Sep 3, 11:48 am, Alexandros Stergiakis <alst...@gmail.com> wrote: >> This is an announcement for a relatively new Tcl project: tcl-mmap >> >> Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides >> a Tcl package that...

How does the Tcl interpret handle results returned from C-created Tcl commands ?
I've ventured on creating a Tcl command trough a C routine. I've followed the manual guidelines. My C routine checks the validity of a selected option for the currently displayed histogram. Therefore it returns a Boolean value that, according to the C <-> Tcl communucation protocol, I have encoded as TCL_ERROR (= FALSE) and TCL_OK (TRUE). WHenthis command is called in a Tcl proc, the interpreter is supposed to perform two different actions according to the returned Boolean value. How can I fetch this returned Boolean result (TCL_ERROR/ TCL_OK) from the Tcl proc that executes the C-created command ? What if I wrote 1 (FALSE) or 0 (TRUE) in a string and have the C routine return this 1-character string ? Would it be easier to get the result of the teest from the caling TCL proc ? Please, find in the following the code that implements (according to my best resolution) the C-created command and the callind Tcl proc. Thank you, Maura ************************************************************************************************************* * C routine * ************************************************************************************************************* static int check_hist_aint_option_cb( ClientData clientData, Tcl_Interp *interp, int argc, char *argv[] ) { int i; if ( hg.active_ &...

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

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

Interfacing Tcl/Tk GUI to existing C code
I've inherited some C code. I'm asked to create a Tcl/Tk GUI to run the C code on both Windows XP and Linux boxes. I'm assuming my Tcl/Tk GUI needs to detect Windows or Linux, then load my C code as a .dll or .so. Is this correct? Also, when I press a button on my Tck/Tk GUI, I'd like to say -command "hello()", and have it call the hello() function in my hello.dll. Can I just souce in the hello.dll and have the call to the hello() magically work? Thanks, Randy randy1200 <randy1200@yahoo.com> wrote: > I've inherited some C code. I'm asked to create a Tcl/Tk GUI > to run the C code on both Windows XP and Linux boxes. > I'm assuming my Tcl/Tk GUI needs to detect Windows or Linux, > then load my C code as a .dll or .so. Is this correct? No. Use [info sharedlibextension] if you are about loading DLL. But remember, that DLL you are loading into Tcl with load command, should have special interface layer written in C, which would translate C function to Tcl command. -- As I currently don't have a floppy drive in my computer, I'd like to make an `emergency cdrom' ;) -- Eugene Crosser <crosser@average.org> "randy1200" <randy1200@yahoo.com> writes: > I've inherited some C code. I'm asked to create a Tcl/Tk GUI to run > the C code on both Windows XP and Linux boxes. There are a number of ways of going about this... > I'm assuming my Tcl/Tk GUI needs to detec...

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

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

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

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

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 old fashioned way,", the most of the advice you read about how to write extensions applies to adding Tcl interfaces to your existing C/C++ code. See http://mini.net/tcl/1191. Java is a slightly different case, because wave have Jacl and TclBlend. Search for them on the Wiki, and you'll find other resources. Bob -- Bob Techentin techentin.robert@NOSPAMmayo.edu Mayo Foundation (507) 538-5495 200 First St. SW FAX (507) 284-9171 Rochester MN, 55901 USA http://www.mayo.edu/sppdg/ In article <bfmaqa$b4u$1@tribune.mayo.edu>, Bob Techentin <techentin.robert@mayo.edu> wrote: . . . >Start with >http://phaseit.net/claird/comp.lang.tcl/HowToC.html . . . Ugh. My, is *that* in need of editing: typos, broken links, .... It might be month before I get to it, th...

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:...

TCL + C interface
Hello: I am currently working on a project that calculates the coordinates of the jovian moons and displays them on the screen. i have GUI built in TCL. All the math for the calulation is written in C. How do i get the two programs to work and also how do i make it an .exe file. The program will have to take the user entered date and time and send it to the C program. The C program will calculate the positions of the moon and these values have to be feed back to the Tcl program so that they can be displayed on the screen. Anyways help will be appreciated Thank You In article <10bb360b.0411160123.4e4062a8@posting.google.com>, Prasunp <prasunp@csufresno.edu> wrote: >Hello: > >I am currently working on a project that calculates the coordinates of >the jovian moons and displays them on the screen. i have GUI built >in TCL. All the math for the calulation is written in C. How do i >get the two programs to work and also how do i make it an .exe file. >The program will have to take the user entered date and time and send >it to the C program. The C program will calculate the positions of >the moon and these values have to be feed back to the Tcl program so >that they can be displayed on the screen. . . . There are many possibilities. It's hard to know from your description which best fits your needs. Read <URL: http://wiki.tcl.tk/1819 >, <URL: http://wiki.tcl.tk/4798 >, and perhaps <URL: http://w...

Tcl/Tk interface
Hello, I have a problem with an interface for my scilab routines. The tcl/tk interface does not handle window size reliable. if you execute the file below scilab produces sometimes the correct window and sometimes only a very small window. I verified this with scilab 3.0, several unstable releases and on different winXP machines and on suse linux. the tiny window happens about 50% on windows machines and never on linux. im not sure if im doing it the right way. interface.sci: ---------------- function UI() // definition of user interface // controls removed for smaller file f = figure(0,"Position",[50 50 600 400],... "BackgroundColor",[0.9 0.9 0.9],... "Unit", "pixel","title","Time Series Tool"); m=uimenu(f,'label', 'File'); // create an item on the menu bar // create an item on the menu bar m1=uimenu(m,'label', 'Load Data', 'callback', "loadFile()"); m2=uimenu(m,'label', 'Exit figure', 'callback', "fin=%t;close()"); m3=uimenu(m,'label', 'quit scilab', 'callback', "exit"); fin=%f while ~fin xpause(10); end close(f); return endfunction //load User Interface UI() ----------------------- can anyone give me a hint? (if you try the file, please try several times) mike Hi, First, you should not put...

Web resources about - create a tcl/tk interface for a c program - comp.lang.tcl

Interface - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Wikipedia for iOS updated w/ redesigned interface, 3D Touch, Handoff & more
... released an update to its iOS app that adds a host of new features and capabilities. The latest version of the app offers a redesigned interface ...

Waze 4.0 unveiled with revamped user interface
... post, Waze has uploaded a video straight to YouTube to tell us what’s new. Basically, we are looking at a complete refresh to the user interface, ...

LibreOffice 5.1 reorganizes user interface, reduces start-up times
... 5.1 32-bit . It comes just under six months after version 5.0 debuted back in August yet unveils some major changes to the user interface as ...

Industrial IoT still needs humans and user interfaces
IoT is getting more automated, but not everything can be done by machines. An engineer who's been working with a system for decades has insights ...

Software brings your PC's entire interface to VR
Virtual reality faces numerous challenges, but one of the biggest is having to take your headset off whenever you need to run a conventional ...

LibreOffice 5.1 Offers Reorganized User Interface for Its Apps
LibreOffice 5.1, the latest iteration of the open-source office suite, adds new user interface elements. We examine highlights of the release. ...

AMD is supposedly planning a 32-core CPU with an eight-channel DDR4 interface
AMD may be planning a new 32-core server CPU once Zen launches but whether that's a good thing or not depends on whether its an Intel bunker ...

Hints Of Apple's Futuristic iPhone Interface Revealed
The US Patent Office has released a batch of patents assigned to Apple, and one of them details a new way of identifying yourself and allowing ...

Where is that sound coming from? Signal Interface’s acoustic imager will show you
... industrial site pinpoints sound coming from a passing truck as well as from equipment on the other side of a buildling. (Credit: Signal Interface ...

Resources last updated: 3/13/2016 8:21:03 PM