[categories] [index] [all (527)] [latest]
systemdict (product) get
connect on port 9100:
nc 192.168.1.10 9100
type this:
%
executive
get that:
PostScript(r) Version 3018.102
(c) Copyright 1984-2004 Adobe Systems Incorporated.
Typefaces (c) Copyright 1981 Linotype-Hell AG and/or its subsidiaries.
All Rights Reserved.
PS>
/printUsage {
(Usage:) =
( a - some stuff) =
( b - other stuff) =
( q - quit) =
} def
printUsage
{
/userInput 128 string def
(>) print flush
(%lineedit) (r) file userInput readline
pop % bool
token not { () } if
{
dup (q) eq { quit } if
dup (a) eq {
pop token pop
(a) =
exit
} if
dup (b) eq {
pop token pop
(b) =
exit
} if
clear
printUsage
exit
} loop
} loop
MyDict {
/v exch def
/k exch def
} forall
(=======================================) ==
pstack
(=======================================) ==
quit
Ghostscript specific:
=only
and
==only
See https://stackoverflow.com/questions/57983225/postscript-tokens-string-only-etc
/userInput 128 string def
(>) print flush
(%lineedit) (r) file userInput readline
pop % bool
{ token not{exit}if == } loop
%!PS-Adobe-2.0
% gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="output-%d.pdf" m.ps
/Courier findfont 12 scalefont setfont
50 700 moveto
1 20 string cvs show
showpage
50 700 moveto
2 20 string cvs show
showpage
50 700 moveto
3 20 string cvs show
showpage
65 1 string dup 0 4 -1 roll put
or
/s ( ) def
s 0 65 put
/MyDict
<<
/MyKey1 (asd)
/MyKey2 { (sdf) }
>> def
MyDict (MyKey1) get == % (asd)
MyDict (MyKey2) get == % { (sdf) }
MyDict (MyKey3) get == % undefined
bind def
: add
lookup occurs once at definition:
save
/foo { add } bind def
1 2 foo == % 3
/add { mul } def
1 2 foo == % 3, uses original add
restore
def
alone: add
lookup occurs each time:
save
/foo { add } def
1 2 foo == % 3
/add { mul } def
1 2 foo == % 2, uses redefined add
restore
data:text/html,
<canvas id=x>
<script>
X = x.getContext("2d");
X.fillRect(10, 10, 20, 20)
</script>
%!PS
% nc 172.16.158.21 9100
/Courier findfont 12 scalefont setfont
32 740 moveto
/s 100 string def
(>) print flush
(%lineedit) (r) file s readline
pop
show
showpage
nc -l 5000
999 3 string cvs print