Re: Tcl "source" command
From: Bruce Graham (abgrah_at_vigyan.com)
Date: 11/25/03
- Next message: Ralf Fassel: "Re: Tcl "source" command"
- Previous message: Arjen Markus: "Re: locale blues: decimal point representation"
- In reply to: Glenn Jackman: "Re: Tcl "source" command"
- Next in thread: Ralf Fassel: "Re: Tcl "source" command"
- Reply: Ralf Fassel: "Re: Tcl "source" command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 25 Nov 2003 08:15:02 -0500
Yes, you understood my problem. I was trying later (after I read more -
duh!) to use the "eval" command to accomplish a dynamic use of the code
the Fortran program just produced. I know I am having difficulty
forming the set of commands into a string/list that "eval" can
successfully operate on. That set of commands is using values of
variables and array elements that are defined in the current context.
Does eval run in the current context? ... Does it know about the
currently defined variables?
Thanks.
Glenn Jackman wrote:
>Bruce Graham <abgrah@vigyan.com> wrote:
>
>
>> I'm trying to have two programs interact. One is a compiled FOrtran
>> code and the other is a Tcl/Tk script. I have the Fortran code write a
>> snip of Tcl I wish the script to "source" to effectively do what the
>> code is saying to do. I think I am getting hung up with WHEN the
>> "source" is happening. If I have, as I do, other instances of a file
>> being sourced that occurs when a button is pressed, that "source" is
>> apparently hidden from being done as the program starts. The "source" I
>> am trying to do in an "if" block (determining whether the file to be
>> sourced exists or not) happens "right now" and, as the file that needs
>> to be sourced does not exist, the script fails.
>>
>> I need a way to "conditionally" execute the "source" command without the
>> "source .." having to be associated with a button. There must be a way
>> to do this.
>>
>>
>
>It sounds like you have a Tk gui, and when you click a button, you run a
>fortran program that returns some Tcl code. Is this right?
>
>What you need to do is [eval] that code, not [source] it.
>
>To trap any syntax errors, you'll want to wrap the [eval] in [catch]
>
>There are obvious security risks in evaluating untrusted code, so you
>may want to research Tcl's safe interpreters.
>
>
>
>
- Next message: Ralf Fassel: "Re: Tcl "source" command"
- Previous message: Arjen Markus: "Re: locale blues: decimal point representation"
- In reply to: Glenn Jackman: "Re: Tcl "source" command"
- Next in thread: Ralf Fassel: "Re: Tcl "source" command"
- Reply: Ralf Fassel: "Re: Tcl "source" command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|