🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.postscript.programming
6 messages
6 total messages Started by Miklos Somogyi Wed, 18 Dec 2002 15:39
%stdin
#1315
Author: Miklos Somogyi
Date: Wed, 18 Dec 2002 15:39
15 lines
1347 bytes
Sometimes I need a few rgb <--> hsb conversions.
I edit a ps file and ask my trusted Level 2 Adobe
DPS to do the job.
If I need more, I edit more, etc.
Would dearly love to skip editing and have a mini
ps program to prompt me for rgb or hsb and print
the other set.
The problem is that read would not wait for input
on %stdin.

Could someone show me a program segment for any
simple write_prompt - read_answer dialogue?
If not, what's the use of %stdin ?

Miklos
Re: %stdin
#1316
Author: Marc Antoni Malagarriga i Picas
Date: Thu, 19 Dec 2002 08:25
17 lines
1256 bytes
I Miklos,

I consider more flexible read and write data with a controlled disk adress, like:

(DiskUnit/MyDir/MyOutputFile) (w) file /MyOutputFile exch def

and write and read data with prompt, like:

MyOutputFile (Merry Christmas Miklos !!) dup == writestring
(DiskUnit/MyDir/MyOutputFile) (r) file /MyImputFile exch def
MyImputFile 100 string readstring pop ==

This helps ?

... MaRC anToni
www.femfum.com
PostScript&PDF Tools Developers
Re: %stdin
#1317
Author: Miklos Somogyi
Date: Thu, 19 Dec 2002 13:39
25 lines
1473 bytes
Thanks and Happy Xmas, MaRC

I don't fully understand your scheme but if I need
to put my data in a file to read it by a ps
program, I might as well put the data in the ps program.

I don't know how and why, my Adobe DPS lets me open
a file for read:

(/dir/file1) (r) file /infile exch def

and lets me read from it, but

(/dir/file2) (w) file /outfile exch def

is not working, I get an invalidfileaccess error.

---

So my question still is: is it poss to read something from
%stdin in the manner of other languages (i.e. the DPS waits
until receives an lf), or not.
If not, what is the purpose of %stdin?

Miklos
Re: %stdin
#1318
Author: Aandi Inston
Date: Thu, 19 Dec 2002 14:21
4 lines
966 bytes
Many PostScript implementations disable file writing, to protect
against malicious code distributed as PostScript.

Aandi Inston
Re: %stdin
#1319
Author: Marc Antoni Malagarriga i Picas
Date: Thu, 19 Dec 2002 15:52
19 lines
1158 bytes
Hi Miklos,

Here is an example with %stdin and %stdout files:

% standard file in/out creation
(%stdin) (r) file /In exch def
(%stdout) (w) file /Out exch def

% writes the string
Out (Hi Noi!) writestring

% reads and prompts the string
In 50 string readstring pop ==

Hope this works for you ...

... MaRC anToni
(][ wwww.femfum.com
PostScript&PDF Tools Developers
Re: %stdin
#1320
Author: Miklos Somogyi
Date: Fri, 20 Dec 2002 04:42
15 lines
1245 bytes
Good point Aaandi, but I don't need to write to a file.
I only need to wite to the screen and "==" can do that.

MaRC, Ghostview does not accept "(%stdout) (w) file" at
all (invalidfileaccess), the Adobe DPS accepts it
but "Out (Hi Noi!) writestring" needs a flush, just
like == does.

However, the crucial part "In 50 string readstring pop =="
does nothing with/without flushing "(Hi Noi!)".
What DPS do you use?

Thanx

Miklos
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads