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


Groups > comp.lang.postscript > #1952

cvx before storing works in one place, but not in another

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.panservice.it!feed.xsnews.nl!border01.ams.xsnews.nl!feeder02.ams.xsnews.nl!frontend-F09-10.ams.news.kpn.nl
From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.postscript
Subject cvx before storing works in one place, but not in another
Organization Decebal Computing
X-Face "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR<J%a^F2lh4[N~Yz4 nSp#c+aQo1b5=?HcNEkQ7QzF<])O3X4MDL/AYjys&*mt>,v+Pti8=Vi/Z"g^?b"E
X-Homepage http://www.decebal.nl/
Date Wed, 06 Aug 2014 19:58:49 +0200
Message-ID <87iom5sdnq.fsf@Equus.decebal.nl> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)
Cancel-Lock sha1:vJXck0jAleL1vhwmVb5QsGEcc5A=
MIME-Version 1.0
Content-Type text/plain
Lines 59
NNTP-Posting-Host 77.171.42.144
X-Trace 1407348087 news.kpn.nl 30774 77.171.42.144@kpn/77.171.42.144:47557
Xref csiph.com comp.lang.postscript:1952

Show key headers only | View raw


I had the following code:
    dup 5 eq {
        /borderPart (borderPart5) cvx def
    } {
        dup 4 eq {
            /borderPart (borderPart4) cvx def
        } {
            dup 3 eq {
                /borderPart (borderPart3) cvx def
            } {
                dup 2 eq {
                    /borderPart (borderPart2) cvx def
                } {
                    /borderPart (borderPart1) cvx def
                } ifelse
            } ifelse
        } ifelse
    } ifelse

Not very neat, so I made a kind of switch statement:
    /mydict 6 dict def
    mydict         1 (borderPart1) put
    mydict         2 (borderPart2) put
    mydict         3 (borderPart3) put
    mydict         4 (borderPart4) put
    mydict         5 (borderPart5) put
    mydict (default) (borderPart5) put
    dup mydict exch known {
        mydict exch get
    } {
        pop
        mydict (default) get
    } ifelse
    /borderPart exch def

Works fine, but there is a strange difference. The last statement can
not be:
    /borderPart exch cvx def

If I do that I get at the place the function is executed:
   Error: /stackunderflow in --exec-

Also strange, if I after
    /borderPart exch cvx def
do:
    /borderPart ==
this gives:
    /borderPart

Without the number.
What could be happening here?

It is not very important: I just do a cvx before the exec, but I am
just curious. ;-)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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


Thread

cvx before storing works in one place, but not in another Cecil Westerhof <Cecil@decebal.nl> - 2014-08-06 19:58 +0200
  Re: cvx before storing works in one place, but not in another luser- -droog <mijoryx@yahoo.com> - 2014-08-06 22:01 -0700
    Re: cvx before storing works in one place, but not in another Cecil Westerhof <Cecil@decebal.nl> - 2014-08-07 14:45 +0200
      Re: cvx before storing works in one place, but not in another luser- -droog <mijoryx@yahoo.com> - 2014-08-14 01:15 -0700
  Re: cvx before storing works in one place, but not in another jdaw1 <jdawiseman@gmail.com> - 2014-08-10 07:41 -0700

csiph-web