Re: read in code verbatim

From: David P. Huenemoerder <dph_at_email.domain.hidden>
Date: Wed, 28 Mar 2007 13:30:52 -0400
    rgibson> I'm often debugging and have to repetitively cut/paste
    rgibson> large amounts of code onto the ISIS command line.  Is
    rgibson> there a simple way to do this?

    rgibson> For example, if I have:

    rgibson> % Lotsa code...
    rgibson> for (i = 0; i < length(x); i++) () = printf("%i\n", x[i]);
    rgibson> % Lotsa code...
    rgibson> % Stuff I want to debug...


    rgibson> Let's say I set x = [ 1, 2, 3].  Then I want to execute
    rgibson> everything in the "Lotsa code" region, in order to get to
    rgibson> the section of code I want to debug.

    rgibson> If I encapsulate the "Lotsa code" in a function, then I
    rgibson> have to define variables like "i", pass parameters, etc.
    rgibson> If I just put the code in a file and call "evalfile",
    rgibson> ISIS apparently does some namespace stuff and it doesn't
    rgibson> work.  What I want is to have a text file with my "Lotsa
    rgibson> code" and tell ISIS to execute that text file just as if
    rgibson> I had pasted it to the command line.

What I think you want is source() instead of evalfile().
source() will interpret as if you typed it to the interpreter.
You can also use the shortcut,

.source file.sl

You can also use  _auto_declare=1 if you want to have evalfile() not
need declarations.


    rgibson> Sorry for the complicated description.  (Search for "?" to find the question in
    rgibson> this email.)




-- 
Dave

David Huenemoerder  617-253-4283 (o); -253-8084 (f); http://space.mit.edu.ezproxyberklee.flo.org/home/dph
MIT Kavli Institute for Astrophysics and Space Research
70 Vassar St., NE80-6065,
Cambridge, MA  02139
[Admin. Asst.: Elaine Tirrell, 617-253-7480, egt_at_email.domain.hidden
----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
Received on Wed Mar 28 2007 - 13:30:56 EDT

This archive was generated by hypermail 2.2.0 : Wed Mar 28 2007 - 13:42:47 EDT