Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1226

Re: save restore problem - is it possible to use it in this way?

X-Received by 10.66.86.130 with SMTP id p2mr7724913paz.22.1357569499079; Mon, 07 Jan 2013 06:38:19 -0800 (PST)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp.club.cc.cmu.edu!newsfeed.news.ucla.edu!usenet.stanford.edu!f6no14243633pbd.1!news-out.google.com!6ni91860pbd.1!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 07 Jan 2013 08:38:18 -0600
From John Deubert <john@acumentraining.com>
Organization Acumen Training
Newsgroups comp.lang.postscript
Date Mon, 7 Jan 2013 06:38:16 -0800
Message-ID <2013010706381659521-john@acumentrainingcom> (permalink)
References <7f92a7b6-e0fa-4481-b50a-9ba3aa56be07@googlegroups.com> <0e0e2def-ead5-467b-8ce9-3729ed1cd0ad@googlegroups.com>
MIME-Version 1.0
Subject Re: save restore problem - is it possible to use it in this way?
User-Agent Unison/2.1.10
Lines 45
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-pTtBSifZ6O8aV5/RS5fBLnOIpaz7LAygXGFegC2DooRso2Gi1uJWjpXqKAaDff0+xAUqoAOkdBltNYE!GfoAolAtQfVcUpphu+HJdVuEUwq+/qX/rEcDz65Ed+xvtp6lpACXi/kQTUL6UyIK8MDTjgbA
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2522
Content-Type text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Xref csiph.com comp.lang.postscript:1226

Show key headers only | View raw


On 2013-01-04 18:10:00 +0000, luser- -droog said:

> On Friday, January 4, 2013 10:39:09 AM UTC-6, wojt...@gmail.com wrote:
> 
>> Should it be ok too?
>> 
>> If yes then probably there is something wrong with the stack between 
>> save and restore and restore have wrong data on the stack? How to check 
>> it? PS file has more than 1k lines :/
> 
> If you can't trust the stack, trust the dictionary.
> 
> /saveobjectA save def
> 
> /saveobjectB save def
> 
> saveobjectB restore
> 
> saveobjectA restore

I'd go a step further and say you should absolutely not use the operand 
stack to store the save objects created by save and used by restore; 
too much opportunity for things to go wrong. It is much better to put 
the objects into a key-value pair, as droog says above.

If you absolutely must leave the saveobject on the stack (perhaps 
because you're working with existing code written by someone else), 
then you can test the top of the stack before executing restore:

dup type /savetype
{ restore }{ ... handle or head off typecheck error here ... } ifelse

- John

-- 
========
John Deubert
Acumen Training
PostScript & PDF Engineering Classes & Consulting
www.acumentraining.com

Learn PostScript programming techniques
Read the free Acumen Journal
acumentraining.com/acumenjournal.html

Back to comp.lang.postscript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

save restore problem - is it possible to use it in this way? wojtulek@gmail.com - 2013-01-04 08:39 -0800
  Re: save restore problem - is it possible to use it in this way? ken <ken@spamcop.net> - 2013-01-04 16:40 +0000
  Re: save restore problem - is it possible to use it in this way? luser- -droog <mijoryx@yahoo.com> - 2013-01-04 10:10 -0800
    Re: save restore problem - is it possible to use it in this way? John Deubert <john@acumentraining.com> - 2013-01-07 06:38 -0800

csiph-web