Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tcl application with tcl application

0 views
Skip to first unread message

teacupfull business

unread,
Dec 17, 2009, 1:03:36 AM12/17/09
to
Here is another question, I have one tcl-based application A, my co-
worker has a tcl-based application B. Now I want to integrate my
application A into the application B.

After integration, I want to be able to run A's tcl command in B.

Assume I can only change A's code, is there any way to do this?

Shin

unread,
Dec 17, 2009, 6:04:03 AM12/17/09
to
On 17 Dez., 07:03, teacupfull business <teacupfull.busin...@gmail.com>
wrote:

Hi,
if A and B are both Tcl scripts, then I'd refactor my application A to
be a library package with a namespace "::A" instead and also with an
exported main procedure like:

::A::run $args

Then, all that B is left to do, is to "require" package A and use it's
funtionality.

Cheers...
Shin

Glenn Jackman

unread,
Dec 21, 2009, 9:45:38 AM12/21/09
to

If you can't change B, how do you expect B to invoke A?

--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous

Shin

unread,
Dec 21, 2009, 9:59:08 AM12/21/09
to
You may try to
You cannot change a program without access to it ;)
You'd need at last access to B's user's .tclshrc file to hook in,
AFAIK.

Larry W. Virden

unread,
Dec 22, 2009, 6:50:06 AM12/22/09
to
On Dec 17, 1:03 am, teacupfull business
<teacupfull.busin...@gmail.com> wrote:

>
> After integration, I want to be able to run A's tcl command in B.

When you write an application, the way to run it, in another tcl
program, is to use exec or open "|..." to call the program.

If, instead of running program A, you want to run the same Tcl proc's
as A uses, but from B, then you have to rewrite A so all of its
functionality is available inside procs, then change B so that it uses
source or package require to get that code into B.

>
> Assume I can only change A's code, is there any way to do this?

If B happened to read a file of the user via source, then with some
work you can do it. If not, if B is a Tk program that you could "send"
commands to via the Tk send command, you might be able to go that
route.

If B is not written in a way to accept commands outside itself, then
you are pretty much going to be out of luck.

0 new messages