Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1961
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Re: cvx before storing works in one place, but not in another |
| Organization | Decebal Computing |
| References | <87iom5sdnq.fsf@Equus.decebal.nl> <c35ccf26-0b4c-4835-a2df-2b570e842dfb@googlegroups.com> |
| Date | 2014-08-07 14:45 +0200 |
| Message-ID | <87a97gsc21.fsf@Equus.decebal.nl> (permalink) |
Op Thursday 7 Aug 2014 07:01 CEST schreef luser:
>> /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-
>
> That much makes sense. But you should be getting the same error
> with the original code if you're doing
>
> borderPart exec
>
> If borderPart is defined as an executable string, then mentioning
> the executable name `borderPart` will load and execute the string,
> yielding an executable name borderPartN, and executing that as well.
>
> I'd write your switch statement a little more concisely
>
> /mydict <<
> 1 /borderPart1 cvx
> 2 /borderPart2 cvx
> 3 /borderPart3 cvx
> 4 /borderPart4 cvx
> 5 /borderPart5 cvx
> /default 1 index
>>> def
> mydict 1 index known not {pop /default} if
> mydict exch get
> /borderPart exch def
I went for:
/mydict <<
1 /borderPart1
2 /borderPart2
3 /borderPart3
4 /borderPart4
5 /borderPart5
/default /BorderPart1
>> def
dup mydict exch known {
mydict exch get
} {
pop
mydict /default get
} ifelse
/borderPart exch def
Putting cvx behind the definitions went wrong. Also
/default 1 index
went wrong.
I look in it/the rest later.
Thanks for the info.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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