Re: Delete COMMON [message #36779] |
Tue, 28 October 2003 12:43 |
the_cacc
Messages: 104 Registered: October 2001
|
Senior Member |
|
|
mperrin+news@cymric.berkeley.edu (Marshall Perrin) wrote in message news:<bnkbh7$2enb$1@agate.berkeley.edu>...
>
> Alternatively, and almost certainly vastly easier, is to modify the
> parts of your code that has this common routine to have an initialize()
> or clear() function of some kind, which would itself be called from the
> top level GUI. That's probably what I would do in your situation...
>
> - Marshall
Hey, great suggestion. I've put in a /CLEAN keyword to tell the code to initialise.
Thanks dude.
|
|
|
Re: Delete COMMON [message #36785 is a reply to message #36779] |
Mon, 27 October 2003 15:59  |
mperrin+news
Messages: 81 Registered: May 2001
|
Member |
|
|
trouble <the_cacc@hotmail.com> wrote:
> mperrin+news@cymric.berkeley.edu (Marshall Perrin) wrote in message news:<bnjhb4$24t7$1@agate.berkeley.edu>...
>>
>> Why do you need to delete the common block? Would deleting all the variables
>> in it be sufficient? See, e.g. delvarx.pro:
>> http://astro.uni-tuebingen.de/software/idl/astrolib/misc/del varx.pro
>>
>> - Marshall
>
>
> Yes, all I need to do is delete the variables. Problem is, it's only
> used deep within a couple of routines, yet I want to destroy it in the
> top level calling function.
>
> It's just so unbearably *painful* to put the COMMON from the numerical
> code into the GUI code and then delete it! COMMON blocks have feelings
> too, you know.
I agree that needlessly proliferating common blocks is no good. I see
two ways out of this situation: One, rewrite the code to not use common
blocks. This may be more of a hassle than it's worth; the way I do this is
to stick all the state into some struct, which then gets passed around
as needed. The problem is that if you expect variable-sized data, you
have to convert everything over to use pointers to access it.
Alternatively, and almost certainly vastly easier, is to modify the
parts of your code that has this common routine to have an initialize()
or clear() function of some kind, which would itself be called from the
top level GUI. That's probably what I would do in your situation...
- Marshall
|
|
|
|
Re: Delete COMMON [message #36788 is a reply to message #36786] |
Mon, 27 October 2003 09:08  |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
I am not so sure I regret not being able to run .reset_all or format c:
/y from inside my code. Might throw users off the track :-)
Cheers,
Pavel
David Fanning wrote:
>
> trouble writes:
>
>> I've been running a program with a COMMON block. To delete is, it
>> seems that .reset is the only option. However, I *always* seem to
>> forget to do it so it's only after 1/2 hour of processing, when the
>> results are clearly wrong, that I remember and have to start over.
>>
>> Is there any way to put a .reset in the code, so it always run fresh?
>
> No. Executive commands ("dot commands") can only be
> run from the IDL command line. :-(
>
> Cheers,
>
> David
>
> P.S. Let's just say Common blocks, like taxes, are
> something we have to be responsible for ourselves in
> the eyes of the law.
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Delete COMMON [message #36789 is a reply to message #36788] |
Mon, 27 October 2003 08:36  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
trouble writes:
> I've been running a program with a COMMON block. To delete is, it
> seems that .reset is the only option. However, I *always* seem to
> forget to do it so it's only after 1/2 hour of processing, when the
> results are clearly wrong, that I remember and have to start over.
>
> Is there any way to put a .reset in the code, so it always run fresh?
No. Executive commands ("dot commands") can only be
run from the IDL command line. :-(
Cheers,
David
P.S. Let's just say Common blocks, like taxes, are
something we have to be responsible for ourselves in
the eyes of the law.
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Delete COMMON [message #36790 is a reply to message #36789] |
Mon, 27 October 2003 08:32  |
mperrin+news
Messages: 81 Registered: May 2001
|
Member |
|
|
trouble <the_cacc@hotmail.com> wrote:
> I've been running a program with a COMMON block. To delete is, it
> seems that .reset is the only option. However, I *always* seem to
> forget to do it so it's only after 1/2 hour of processing, when the
> results are clearly wrong, that I remember and have to start over.
>
> Is there any way to put a .reset in the code, so it always run fresh?
Why do you need to delete the common block? Would deleting all the variables
in it be sufficient? See, e.g. delvarx.pro:
http://astro.uni-tuebingen.de/software/idl/astrolib/misc/del varx.pro
- Marshall
|
|
|