Re: Tcl "source" command

From: Bruce Graham (abgrah_at_vigyan.com)
Date: 11/25/03


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



Relevant Pages

  • system command
    ... Anybody know how one can give commands to the operation system from ... the fortran program? ... I work with pgf90 compiler under Linux... ...
    (comp.lang.fortran)
  • Re: OSX on Intel Could Destroy Microsoft
    ... >> to web apps, it's worth remember that an app that works in just Firefox ... > environments than a web app that requires Safari or Firefox. ... I think commands are more discoverable when they're ... >> desktop app, if a command is grayed out, what context do you have to be ...
    (comp.sys.mac.advocacy)
  • Re: Problem with services
    ... Whenever any process is run on windows it is run within a Context. ... You must change the working directory to the directory of where your ... Windows and the preferred method is to use net commands. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Button list control
    ... acting in the context of a program framework. ... Controls are the basis of a user interface. ... >> available commands. ... The File menu is renamed Transaction and contains a submenu Action ...
    (comp.lang.pascal.delphi.misc)
  • Re: ExtEscape in spooler context ???
    ... I think you want to send some commands based on information available in the ... > Application context in the DocumentEvent_STARTDOCPOST and I was able to ... > render(in spooler context) comes after the Job Setup commands in the ...
    (microsoft.public.win32.programmer.gdi)