Reply to topic  [ 3 posts ] 
Issue when restoring over self 
Author Message
Yorick Master

Joined: Wed Jun 01, 2005 11:34 am
Posts: 112
Post Issue when restoring over self
The documentation for "restore" mentions that you can use syntax like "scratch = save(scratch, xy)" followed later by "restore, scratch" to backup and restore the values of scratch and xy. However, this does not work.

Specifically: When using "restore, NAME", the restore will restore all members of group NAME if and only if group NAME contains no members named NAME. If any members are named NAME, then it stops restoring at that point.

The following illustrates:

Code:
> func showproblem {
cont> a = b = 2;
cont> foo = save(a,b,foo);
cont> bar = save(a,bar,b);
cont> baz = save(baz,a,b);
cont>
cont> a = b = 1;
cont> restore, foo;
cont> write, format="a=%d b=%d foo\n", a, b;
cont>
cont> a = b = 1;
cont> restore, bar;
cont> write, format="a=%d bar b=%d\n", a, b;
cont>
cont> a = b = 1;
cont> restore, baz;
cont> write, format="baz a=%d b=%d\n", a, b;
cont> }
> showproblem
a=2 b=2 foo
a=2 bar b=1
baz a=1 b=1
>


I can see why this might happen: once the group has restored over itself, perhaps it no longer exists for the remaining items to be restored from?

Fortunately it's easy enough to work around: "scratch = save(xy, scratch)" or "restore, scratch, xy, scratch" suffice.


Tue Aug 24, 2010 7:16 am
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post 
Thank you. This was a fairly serious bug in yapi.c (not oxy.c - it didn't really have to do with the new object interface). I just committed the change, so let me know if the problem persists for you.


Sat Aug 28, 2010 4:43 pm
Profile
Yorick Master

Joined: Wed Jun 01, 2005 11:34 am
Posts: 112
Post 
It now works as expected for me. Thanks for the fix!


Wed Sep 01, 2010 7:17 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.