comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: restore all but ! variables
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: restore all but ! variables [message #60629] Thu, 29 May 2008 14:04 Go to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
Jeremy Bailin wrote:
> Does anyone know of a convenient way of restoring the contents of a
> SAVEd file created using /ALL that will restore everything except for
> system variables (ie. anything starting with !)? I have some old .sav
> files from a different system with a different file structure, and
> doing a simple RESTORE over-writes things like !PATH that really need
> to be from the new system.

I think the IDL_Savefile class should be able to do what you want, but
the "everything else" needs to be enumerated i.e. regular variables
and common blocks should be sufficient:

IDL> save, /all, filename='all.sav'
IDL> exit
~$ idl
IDL> savfile = obj_new('idl_savefile', filename='all.sav')
IDL> savfile->restore, savfile->names(), /verbose ; regular
variables
IDL> savfile->restore, savfile->names(/common_block), /common, /
verbose ; common blocks
IDL> obj_destroy, savfile

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
Re: restore all but ! variables [message #60631 is a reply to message #60629] Thu, 29 May 2008 13:31 Go to previous messageGo to next message
Bob[3] is currently offline  Bob[3]
Messages: 60
Registered: December 2006
Member
On May 29, 12:11 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> Does anyone know of a convenient way of restoring the contents of a
> SAVEd file created using /ALL that will restore everything except for
> system variables (ie. anything starting with !)? I have some old .sav
> files from a different system with a different file structure, and
> doing a simple RESTORE over-writes things like !PATH that really need
> to be from the new system.

How about (temporarily) SAVEing the new system's system variables in a
SAV file using /SYSTEM_VARIABLES then RESTOREing them after you've
restoring the sav file from the old system?
Re: restore all but ! variables [message #60633 is a reply to message #60631] Thu, 29 May 2008 09:14 Go to previous messageGo to next message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
Jeremy Bailin wrote:
> Does anyone know of a convenient way of restoring the contents of a
> SAVEd file created using /ALL that will restore everything except for
> system variables (ie. anything starting with !)? I have some old .sav
> files from a different system with a different file structure, and
> doing a simple RESTORE over-writes things like !PATH that really need
> to be from the new system.
>
> On a related note, is there a way to rename a common block? I.e. I
> have a .sav file that contains a previous version of a common block,
> but in my current code I have extended the common block to include
> some new variables. So I would like to do something like this so that
> I can resurrect the saved data into the new data structure where my
> new code can operate on it:
>
> restore, 'oldsavedfile'
> ***RENAME cb (WITH ASSOCIATED vars) TO oldcb (WITH ASSOCIATED
> oldvars)***
> common_block, cb, LIST OF VARIABLES IN NEW COMMON BLOCK
> ASSIGN oldvars TO EQUIVALENT vars
> save, 'newsavedfile', ....
>
> -Jeremy.

Jeremy,

If you've not seen them you should look at Craig Markwardt's
save/restore routines which could provide some help:

http://cow.physics.wisc.edu/~craigm/idl/cmsave.html

Thanks,

Allan
Re: restore all but ! variables [message #60752 is a reply to message #60631] Thu, 05 June 2008 11:01 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
>> Does anyone know of a convenient way of restoring the contents of a
>> SAVEd file created using /ALL that will restore everything except for
>> system variables (ie. anything starting with !)? I have some old .sav
>> files from a different system with a different file structure, and
>> doing a simple RESTORE over-writes things like !PATH that really need
>> to be from the new system.
>
> How about (temporarily) SAVEing the new system's system variables in a
> SAV file using /SYSTEM_VARIABLES then RESTOREing them after you've
> restoring the sav file from the old system?

Why didn't I think of that? Great idea - works beautifully. :-)=
Thanks!

-Jeremy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: widget, draw and file pickup
Next Topic: Javabridge trial

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:34:38 PDT 2025

Total time taken to generate the page: 0.00992 seconds