Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1249 > unrolled thread
| Started by | Don Lancaster <don@tinaja.com> |
|---|---|
| First post | 2013-02-09 15:53 -0700 |
| Last post | 2013-02-10 18:39 -0700 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.postscript
Filtering problem in GhostScript? Don Lancaster <don@tinaja.com> - 2013-02-09 15:53 -0700
Re: Filtering problem in GhostScript? Don Lancaster <don@tinaja.com> - 2013-02-09 16:22 -0700
Re: Filtering problem in GhostScript? SaGS <sags5495@gmail.com> - 2013-02-10 01:10 -0800
Re: Filtering problem in GhostScript? Don Lancaster <don@tinaja.com> - 2013-02-10 18:39 -0700
| From | Don Lancaster <don@tinaja.com> |
|---|---|
| Date | 2013-02-09 15:53 -0700 |
| Subject | Filtering problem in GhostScript? |
| Message-ID | <ano2b2Fntj2U1@mid.individual.net> |
I have long used this super elegant array to string converter in
PostScript...
/makestring {dup length string dup % new string of right size
/NullEncode filter % make a file out of string
3 -1 roll
{1 index exch write} forall
pop
} def
Yet it seems to fail in GhostScript, writing all nulls instead.
Does anyone see the problem?
--
Many thanks,
Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com
Please visit my GURU's LAIR web site at http://www.tinaja.com
[toc] | [next] | [standalone]
| From | Don Lancaster <don@tinaja.com> |
|---|---|
| Date | 2013-02-09 16:22 -0700 |
| Message-ID | <ano427Foa1dU1@mid.individual.net> |
| In reply to | #1249 |
On 2/9/2013 3:53 PM, Don Lancaster wrote:
>
> I have long used this super elegant array to string converter in
> PostScript...
>
> /makestring {dup length string dup % new string of right size
> /NullEncode filter % make a file out of string
> 3 -1 roll
> {1 index exch write} forall
> pop
> } def
>
> Yet it seems to fail in GhostScript, writing all nulls instead.
>
> Does anyone see the problem?
>
>
Yet this slow sledgehammer replacement seems to work just fine...
/makestring1 { /inarray1 exch store
/outstring1 inarray1 length string store
0 1 inarray1 length 1 sub {/posn exch store
inarray1 posn get
outstring1 exch posn exch put } for
outstring1 dup length string cvs
} store
--
Many thanks,
Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com
Please visit my GURU's LAIR web site at http://www.tinaja.com
[toc] | [prev] | [next] | [standalone]
| From | SaGS <sags5495@gmail.com> |
|---|---|
| Date | 2013-02-10 01:10 -0800 |
| Message-ID | <19b43ab2-22b3-4277-bfa8-f8d5223037a0@y4g2000yqa.googlegroups.com> |
| In reply to | #1249 |
On Feb 10, 12:53 am, Don Lancaster <d...@tinaja.com> wrote:
> I have long used this super elegant array to string converter in
> PostScript...
>
> /makestring {dup length string dup % new string of right size
> /NullEncode filter % make a file out of string
> 3 -1 roll
> {1 index exch write} forall
> pop
> } def
>
> Yet it seems to fail in GhostScript, writing all nulls instead.
The NULs are from the initial value of the string, not something
(incorrectly) written to it.
>
> Does anyone see the problem?
> ...
Buffering.
To be sure the filter wrote everything (or *any*thing at all, if input
is short) to its target, do at least a flushfile; in this case a
closefile is even better.
[toc] | [prev] | [next] | [standalone]
| From | Don Lancaster <don@tinaja.com> |
|---|---|
| Date | 2013-02-10 18:39 -0700 |
| Message-ID | <anr0ehFdlj4U1@mid.individual.net> |
| In reply to | #1253 |
On 2/10/2013 2:10 AM, SaGS wrote:
>> /makestring {dup length string dup % new string of right size
>> /NullEncode filter % make a file out of string
>> 3 -1 roll
>> {1 index exch write} forall
>> pop
>> } def
This works just fine.
Thanks for your help.
/makestring {dup length string dup % new string of right size
/NullEncode filter % make a file out of string
3 -1 roll
{1 index exch write} forall
closefile
} def
--
Many thanks,
Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com
Please visit my GURU's LAIR web site at http://www.tinaja.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web