Re: Adding new application commands

Juergen Schoenwaelder (schoenw@sol)
Sun, 9 Jan 94 20:48:59 +0100

Hi!

Nenad> I hope somebody can help me with this one!

Nenad> Well, what I am trying to do is to add an application which
Nenad> will interact with tkined. Hence, I thought that an obvious
Nenad> thing to do is to register new C commands in the same
Nenad> Tcl_AppInit function that resides in tkined.c which is called
Nenad> from the main. There, I would simply call myapp_init
Nenad> procedure that ought to register new commands to the tcl
Nenad> interpreter.

Nenad> My trouble is that the interpreter forgets the new command
Nenad> ones I try to invoke it from a tcl script. I say forget
Nenad> because it recognizes it immediately after the command is
Nenad> registered in the Tcl_AppInit procedure.

Nenad> What is going on???

Nenad> I am not sure what is happening and need help pretty fast.
Nenad> Thanks for your suggestions in advance!

Nenad> Nenad Ivezic
Nenad> Carnegie Mellon University
Nenad> Pittsburgh, PA, USA

In order to write an application that uses tkined, you do not need to
change any line of the tkined source code (and you better should not).
Applications run in their own process (normally a somewhat extended
tcl interpreter) that interacts with the tkined editor using a
socketpair. The communication protocol is hidden by a set of 'ined
...' commands described in the tkined man page. See my reply to an
earlier question for an example script.

What you have to do is to add your new commands to tclsh or scotty or
whatever tcl interpreter you prefer. Then write a script that handles
the interaction with tkined and your new extended tcl interpreter.

Hope this helps,

Juergen

P.S. You can get archived messages by sending the command
'get tkined tkined-mail-archive' to majordomo@ibr.cs.tu-bs.de.