rbogen@EBAY.SUN.COM (Richard Bogen) (10/26/89)
In honor of the release of X11/NeWS on SUN3's here is a file which
produces a 2 page reference card listing of datatypes & operators.
Try sending it to your laserprinter after loading it with card stock.
-------------------------Now Cut This Out! -------------------------
%!
% NeWS Reference Card
%
% From: ou@ulowell.UUCP (Chris Katsaounis)
% Date: 3 Jul 86 17:04:07 GMT
%
% Modified: October 20, 1989 by rbogen@sun.com (Richard A. Bogen)
% To reflect changes from X11 merge
% ==========================================================================
% start of my stuff
% ==========================================================================
% timing stuff if on a printer
errordict begin
/handleerror {showpage 100 100 moveto $error /errorname get 30 string cvs
show} def
end
/NeWS? systemdict /newcanvas known def
/pgsize 14 def
/captitlesize 14 def
/titlesize 12 def
/subheadsize 8 def
/normsize 6.9 def % was 7
/subsize 5 def
/stackfont /Helvetica findfont normsize scalefont def
/emphfont /Helvetica-Oblique findfont normsize scalefont def
/cmdfont /Helvetica-Bold findfont normsize scalefont def
/symfont /Symbol findfont normsize scalefont def
/subfont /Helvetica findfont subsize scalefont def
/subheadfont /Helvetica-Bold findfont subheadsize scalefont def
/extend { 1.0 mul } def
/hvb /Helvetica-Bold findfont def
/headpage hvb [ pgsize extend 0 0 pgsize 0 0 ] makefont def
/headcaptitle hvb [ captitlesize extend 0 0 captitlesize 0 0 ] makefont def
/headtitle hvb [ titlesize extend 0 0 titlesize 0 0 ] makefont def
/rmargin 234 def % right margin
/halign 75 def % horizontal alignment position
/vlimit 65 def % lines per page (was 66)
/boxheight 14 def % height of title box
/linespace 8.48 def % amount to skip per line (was 8.45)
/curline 1 def % current line
/hpos 0 def % current horizontal position
/pageface 0 def % which logical page (0=init, 1=left, 2=mid, 3=right)
/pageno 4 def % page number
/suboffset 2 def % subscript offset
/linewidth .2 def % standard line width
/titlexoff 5 def % title x offset
/titleyoff 2 def % title y offset
/empty (\320) def
/pagestring 2 string def
/inch { 72 mul } def
/printf { print flush } def
% - SETUP -
% set up initial environment
/SETUP {
90 rotate
-7 0 translate % left x shift for symmetry
newpath
11 inch 3 div -0.5 inch moveto 0 -7.5 inch rlineto
11 inch 2 mul 3 div -0.5 inch moveto 0 -7.5 inch rlineto
linewidth setlinewidth
stroke
15 -34 translate % true offset
11 inch 3 div neg 0 translate % negative translate so the next PAGE
% will return to the same spot.
} def
% llx lly urx ury "box" -
/box {
4 dict begin
/ury exch def
/urx exch def
/lly exch def
/llx exch def
gsave newpath
llx lly moveto
urx lly lineto
urx ury lineto
llx ury lineto
closepath
linewidth setlinewidth stroke
grestore
end
} def
% llx lly urx ury lo hi "fountain" -
/fountain {
10 dict begin
/fend exch def
/fstart exch def
/ury exch def
/urx exch def
/lly exch def
/llx exch def
/flen fend fstart sub 1 add def
/fstr flen string def
fstart 1 fend {
fstr exch dup
255 div 180 mul cos neg 2 div .5 add 255 mul cvi
exch fstart sub exch put
} for
gsave
urx ury translate
180 rotate
urx llx sub ury lly sub scale
% 128 13 sub 10 8
flen 10 8
% [-128 13 add 0 0 10 128 13 sub 0] {fstr} image
[flen neg 0 0 10 flen 0] {fstr} image
grestore
end
} def
% - PAGE -
% start new page
% We want to print the pages in a different order so that the Reference Card
% can be folded correctly: 5 6 1 2 3 4
/PAGE {
/pageno pageno 1 add def
pageno 6 gt { /pageno 1 def } if
pageno pagestring cvs /pagesubstring exch def
pagesubstring printf
pageface 3 mod 0 eq
pageface 0 gt and {
showpage
SETUP
} if
/pageface pageface 1 add def
11 inch 3 div 0 translate
% draw the fountain
0 0 rmargin boxheight 48 239 fountain
0 0 rmargin boxheight box
% draw "NeWS Reference Card" in outlines
newpath titlexoff titleyoff moveto
headcaptitle setfont (NeWS) NeWS? {gsave .5 setgray show grestore}
{true charpath} ifelse
headcaptitle setfont ( R) NeWS? {gsave .5 setgray show grestore}
{true charpath} ifelse
headtitle setfont (EFERENCE) NeWS? {gsave .5 setgray show grestore}
{true charpath} ifelse
headcaptitle setfont ( C) NeWS? {gsave .5 setgray show grestore}
{true charpath} ifelse
headtitle setfont (ARD) NeWS? {gsave .5 setgray show grestore}
{true charpath} ifelse
NeWS? not {gsave 1 setgray fill grestore
linewidth setlinewidth stroke} if
% draw the page number in outlines
NeWS? not {headpage setfont
newpath 0 0 moveto
pagesubstring true charpath pathbbox pop exch pop exch pop
rmargin exch sub titlexoff sub titleyoff newpath moveto
pagesubstring true charpath
gsave 1 setgray fill grestore
linewidth setlinewidth stroke} if
newpath 0 0 moveto
/curline 0 def
NL
(. ) printf
} def
% - NL -
% newline function
/NL {
currentpoint exch pop linespace sub 0 exch moveto
/curline curline 1 add def
curline vlimit gt {
PAGE
} if
} def
% vert VNL -
% customized newline function
/VNL {
currentpoint exch pop exch sub 0 exch moveto
/curline curline 1 add def
curline vlimit gt {
PAGE
} if
} def
% - HNL -
% half-newline function
/HNL {
currentpoint exch pop linespace 2 div sub 0 exch moveto
/curline curline 0.5 add def
curline vlimit gt {
PAGE
} if
} def
% cmd args results "C" -
/C {
/results exch def
/args exch def
/cmd exch def
stackfont setfont /args load xwidth
halign exch sub
currentpoint exch pop moveto
/args load xshow
cmdfont setfont ( ) show cmd show ( ) show
currentpoint pop /hpos exch def
stackfont setfont /results load xshow
NL
} def
% results "CC" -
% for alternate results. Prints only the arrow and the results, aligned
% to the previous arrow.
/CC {
/results exch def
currentpoint exch pop hpos exch moveto
stackfont setfont /results load xshow
NL
} def
% proc|string RJ -
% sets proc or string right justified, in emphfont, without a newline
/RJ {
/rjarg exch def
emphfont setfont /rjarg load xwidth
rmargin exch sub
currentpoint exch pop moveto
/rjarg load xshow
} def
% proc|string CT -
% centers proc or string within the current margins, without a newline
/CT {
dup xwidth rmargin exch sub 2 div
currentpoint exch pop moveto
xshow
} def
% x HT -
% horizontal tab -- moves to horizontal position x, leaving y unchanged.
/HT {
currentpoint exch pop moveto
} def
% (str1) (str2) (str3) T -
% sets three strings in cmdfont in three columns, divided evenly
% within 0 and rmargin.
/T {
cmdfont setfont
rmargin 3 div 2 mul HT show
rmargin 3 div HT show
0 HT show
NL
} def
% =================== utilities for use within xshow =======================
% subscript
/- {
/savefont currentfont def
subfont setfont
currentpoint suboffset sub moveto
} def
/+ {
savefont setfont
currentpoint suboffset add moveto
} def
% turnstile
/ts {
(|) show
-1 0 rmoveto
(\261) show
} def
% prime
/' {
currentfont
symfont setfont
(\242) show
setfont
} def
% vertical bar
/| {
currentfont
symfont setfont
(\275) show
setfont
} def
% ellipses
/... {
currentfont
symfont setfont
(\274) show
setfont
} def
% shorthand
/+| {+ |} def
% note for version 38.0
/v38 { ((v. 38.0)) RJ } def
% ==========================================================================
% extended show stuff
/xdict 20 dict def
xdict begin
/arraytype { cvx exec } def
/booleantype {} def
/dicttype {} def
/filetype {} def
/fonttype {} def
/integertype {} def
/marktype {} def
/nametype { cvx exec } def
/nulltype {} def
/operatortype {} def
/realtype {} def
/savetype {} def
/stringtype { show } def
end
% string xshow -
% array xshow -
% If given a string, xshow simply shows it.
% If given an array, xshow evaluates each element of it, as follows:
% string: shows it
% array: executes it
% name: executes it
% all other elements are ignored.
/xshow {
dup type /stringtype eq {
show
} {
xdict begin
{ dup type exec } forall
end
} ifelse
} def
% string|proc xwidth
% finds the x width of a string or proc
/xwidth {
matrix currentmatrix gsave % get CTM for current device
nulldevice % install null device so nothing is output
setmatrix % set up previous CTM
0 0 moveto
xshow
currentpoint pop
grestore
} def
% ==========================================================================
% set up initial environment
(Page: ) printf
SETUP
PAGE
% ===================== Laserwriter-specific stuff =========================
HNL NL subheadfont setfont
(NeWS Datatype Extensions) CT NL NL
stackfont setfont
(Monitor, color, graphicsstate, and path are simple types.) show NL
(Canvas, cursor, event, process, environment,) show NL
(colormap, colormapentry, and visual are complex objects) show NL
(with key-values accessible as with dictionaries.) show NL NL
(/Key) (putValue) (getValue) C
HNL NL subheadfont setfont (Canvas) CT NL NL stackfont setfont
(/TopCanvas) empty (canvas) C
(/BottomCanvas) empty {(canvas)| (null)} C
(/CanvasAbove) empty {(canvas) | (null)} C
(/CanvasBelow) empty {(canvas) | (null)} C
(/TopChild) empty {(canvas) | (null)} C
(/Parent) {(canvas) | (null)} {(canvas) | (null)} C
(/Transparent) (boolean) (boolean) C
(/Mapped) (boolean) (boolean) C
(/Retained) (boolean) (boolean) C
(/SaveBehind) (boolean) empty C
(/Color) empty (boolean) C
(/EventsConsumed) (name) (name) C
(/Interests) empty (array) C
(/Cursor) (cursor) {(cursor) | (null)} C
(/Colormap) (colormap) (colormap) C
(/Visual) empty (visual) C
(/VisualList) empty (array) C
(/OverrideRedirect) empty (boolean) C
(/BorderWidth) {(null) | (integer)} {(null) | (integer)} C
(/UserProps) (dict) (dict) C
(/XID) empty (number) C
(/SharedFile) (string) (string) C
(/RowBytes) empty (number) C
(/Grabbed) (boolean) (boolean) C
(/GrabToken) empty (integer) C
HNL NL subheadfont setfont (Cursor) CT NL NL stackfont setfont
(/CursorChar) empty (integer) C
(/CursorColor) empty (object) C
(/CursorFont) empty (object) C
(/MaskChar) empty (integer) C
(/MaskColor) empty (object) C
(/MaskFont) empty (object) C
HNL NL subheadfont setfont (Visual) CT NL NL stackfont setfont
(/Size) empty (number) C
(/Class) empty (object) C
(/BitsPerPixel) empty (number) C
HNL NL subheadfont setfont (Colormap) CT NL NL stackfont setfont
(/Entries) empty (array) C
(/Free) empty (number) C
(/Installed) (boolean) (boolean) C
(/Visual) empty (object) C
PAGE
HNL NL subheadfont setfont (Colormapentry) CT NL NL stackfont setfont
(/Colormap) empty (object) C
(/Mask) empty (integer) C
(/Slot) empty (integer) C
HNL NL subheadfont setfont (Process) CT NL NL stackfont setfont
(/BindOverride) (boolean) (boolean) C
(/DictionaryStack) empty (array) C
(/ErrorCode) empty (name) C
(/ErrorDetailLevel) (integer) (integer) C
(/Execee) empty (object) C
(/ExecutionStack) empty (array) C
(/Interests) empty (array) C
(/OperandStack) empty (array) C
(/State) empty (array) C
(/PackedArrays) (boolean) (boolean) C
(/Priority) (integer) (integer) C
(/ProcessName) (name) (name) C
(/Stdout) (file) (file) C
(/Stderr) (file) (file) C
(/SendContexts) empty (array) C
(/SendStack) empty (array) C
HNL NL subheadfont setfont (Event) CT NL NL stackfont setfont
(/Action) (object) (object) C
(/Canvas) {(dict) | (array) | (canvas) | (null)}
{(dict) | (array) | (canvas) | (null)} C
(/ClientData) (object) (object) C
(/Exclusivity) (boolean) (boolean) C
(/Interest) empty (event) C
(/IsInterest) empty (boolean) C
(/IsPreChild) empty (boolean) C
(/IsQueued) empty (boolean) C
(/KeyState) empty (array) C
(/Name) (object) (object) C
(/Priority) (number) (number) C
(/Process) {(null)|(process)} {(null)|(process)} C
(/Serial) empty (number) C
(/TimeStamp) (number) (number) C
(/XLocation) (number) (number) C
(/YLocation) (number) (number) C
(/Coordinates) (xnumber ynumber) (xnumber ynumber) C
HNL NL subheadfont setfont (Environment) CT NL NL stackfont setfont
(/BellDuration) (integer) (integer) C
(/BellPitch) (number) (number) C
(/BellPercent) (number) (number) C
(/KeyClickPercent) (number) (number) C
(/Leds) (integer) (integer) C
(/AutoRepeat) (boolean) (boolean) C
(/KeyRepeatTime) (number) (number) C
(/KeyRepeatThresh) (number) (number) C
(/MotionCompression) (boolean) (boolean) C
(/Threshold) (integer) (integer) C
(/AccelNumerator) (number) (number) C
(/AccelDenominator) (number) (number) C
PAGE
%NeWS operators
HNL NL subheadfont setfont
(NeWS Operators by Type) CT NL NL
stackfont setfont
HNL NL subheadfont setfont (Path Operators) CT NL NL stackfont setfont
(copyarea) (dx dy) empty C
(currentpath) empty (path) C
(damagepath) empty empty C
(emptypath) empty (boolean) C
(eocopyarea) (dx dy) empty C
(eocurrentpath) empty (path) C
(eoextenddamage) empty empty C
(eoextenddamageall) empty empty C
(extenddamage) empty empty C
(extenddamageall) empty empty C
(pointinpath) (x y) (boolean) C
(setpath) (path) empty C
HNL NL subheadfont setfont (Canvas Operators) CT NL NL stackfont setfont
(buildimage) (w h bits matrix proc) (canvas) C
(canvasesunderpath) empty (array) C
(canvasesunderpoint) {(null) | (xnum ynum)} (array) C
(canvastobottom) (canvas) empty C
(canvastotop) (canvas) empty C
(clipcanvas) empty empty C
(clipcanvaspath) empty empty C
(createdevice) (string) (canvas) C
(createoverlay) (canvas) (canvas) C
(currentcanvas) empty (canvas) C
(eoclipcanvas) empty empty C
(eoreshapecanvas) (canvas) empty C
(eowritecanvas) {(file) | (string)} empty C
(eowritescreen) {(file) | (string)} empty C
(getcanvaslocation) (canvas) (x y) C
(getcanvashape) empty (path) C
(imagecanvas) (canvas) empty C
(imagemaskcanvas) (boolean canvas) empty C
(insertcanvasabove) (canvas x y) empty C
(insertcanvasbelow) (canvas x y) empty C
(movecanvas) {(x y)| (x y canvas)} empty C
(newcanvas) {(pcan) | (pcan visual cmap)} (ncan) C
(readcanvas) {(file) | (string)} (canvas) C
(reshapecanvas) {(canvas)| (canvas path width)} empty C
(setcanvas) (canvas) empty C
(writecanvas) {(file) | (string)} empty C
(writescreen) {(file) | (string)} empty C
HNL NL subheadfont setfont (Cursor Operators) CT NL NL stackfont setfont
(currentcursorlocation) empty (x y) C
(getcanvascursor) (canvas) (font char char) C
(grabcursor) {(cursor) | (null)} empty C
(newcursor) (char char font <font>) (cursor) C
(setcanvascursor) (font char char) empty C
(setcursorlocation) (x y) empty C
PAGE
HNL NL subheadfont setfont (Colormap Operators) CT NL NL stackfont setfont
(createcolormap) (visual) (colormap) C
(createcolorsegment) (colormap color) (colormapentry) C
(createcolorsegment) (colormap int int) (array) C
(currentbackpixel) empty (integer) C
(currentpixel) empty (integer) C
(getcolor) (cmapseg integer) (color) C
(putcolor) (cmapseg int color) empty C
(setbackpixel) (integer) empty C
(setpixel) (integer) empty C
HNL NL subheadfont setfont (Color Operators) CT NL NL stackfont setfont
(contrastswithcurrent) (color) (boolean) C
(currentbackcolor) empty (color) C
(currentcolor) empty (color) C
(hsbcolor) (h s b) (color) C
(rgbcolor) (r g b) (color) C
(setcolor) (color) empty C
(setbackcolor) (color) empty C
HNL NL subheadfont setfont (Process Operators) CT NL NL stackfont setfont
(breakpoint) empty empty C
(continueprocess) (process) empty C
(createmonitor) empty (monitor) C
(currentprocess) empty (process) C
(currentshared) empty (boolean) C
(fork) (proc) (process) C
(forkunix) (string) empty C
(geteventlogger) empty (process) C
(getprocesses) empty (array) C
(getprocessgroup) {(process) | (null)} (array) C
(killprocess) (process) empty C
(killprocessgroup) (process) empty C
(monitor) (monitor proc) empty C
(monitorlocked) (monitor) (boolean) C
(newprocessgroup) empty empty C
(pause) empty empty C
(seteventlogger) (process) empty C
(setshared) (boolean) empty C
(suspendprocess) empty empty C
(waitprocess) (process) (value) C
PAGE
HNL NL subheadfont setfont (Event Operators) CT NL NL stackfont setfont
(awaitevent) empty (event) C
(blockinputqueue) (num) empty C
(countinputqueue) empty (num) C
(createevent) empty (event) C
(expressinterest) {(event)| (event process)} empty C
(getmousetranslation) empty (boolean) C
(lasteventkeystate) empty (array) C
(lasteventtime) empty (num) C
(lasteventx) empty (num) C
(lasteventy) empty (num) C
(postcrossings) (can can name name bool) empty C
(recallevent) (event) empty C
(redistributeevent) (event) empty C
(revokeinterest) {(event)|(event process)} empty C
(sendevent) (event) empty C
(unblockinputqueue) empty empty C
HNL NL subheadfont setfont (File Operators) CT NL NL stackfont setfont
(acceptconnection) (listenfile) (file) C
(countfileinputtoken) (file) (integer) C
(getfileinputtoken) {(int) | (int file)} (object) C
(getsocketlocaladdress) (file) (string) C
(getsocketpeername) (file) (string) C
(setfileinputtoken) (object int <file>) empty C
(tagprint) (num) empty C
(typedprint) (object) empty C
(writeobject) (file object) empty C
HNL NL subheadfont setfont (Mathematical Operators) CT NL NL stackfont setfont
(arccos) (num) (num) C
(arcsin) (num) (num) C
(arctan) (num) (num) C
(max) (num num) (num) C
(min) (num num) (num) C
(random) empty (num) C
HNL NL subheadfont setfont (Keyboard and Mouse Operators) CT NL NL stackfont setfont
(getkeyboardtranslation) empty (num) C
(getmousetranslation) empty (boolean) C
(keyboardtype) empty (num) C
(setkeyboardtranslation) (boolean) empty C
(setmousetranslation) (boolean) empty C
PAGE
HNL NL subheadfont setfont (Font Operators) CT NL NL stackfont setfont
(encodefont) {(font array) | (font name)} (font) C
(enumeratefontdicts) empty (names) C
(findfilefont) (string) (font) C
(fontascent) (font) (integer) C
(fontdescent) (font) (integer) C
(fontheight) (font) (integer) C
HNL NL subheadfont setfont (Miscellaneous Operators) CT NL NL stackfont setfont
(currentautobind) empty (boolean) C
(currentpacking) empty (boolean) C
(currentplanemask) empty (integer) C
(currentprintermatch) empty (boolean) C
(currentrasteropcode) empty (num) C
(currentstate) empty (state) C
(currenttime) empty (num) C
(getcard32) (string integer) (integer) C
(getenv) (string1) (string2) C
(harden) (object) (object) C
(localhostname) empty (string) C
(objectdump) (file) empty C
(packedarray) (objects int) (packedarray) C
(packedarraytype) (object) (boolean) C
(pathforallvec) (array) empty C
(putcard32) (string integer integer) empty C
(putenv) (string1 string2) empty C
(refcnt) (object) (integer integer) C
(reffinder) {(object) | (object boolean)} empty C
(setautobind) (boolean) empty C
(setpacking) (boolean) empty C
(setplanemask) (integer) empty C
(setprintermatch) (boolean) empty C
(setrasteropcode) (num) empty C
(setstate) (graphicsstate) empty C
(soft) (object) (boolean) C
(soften) (object) (object) C
(truetype) (object) (name) C
(undef) (dictionary key) empty C
(vmstatus) (avail used size) empty C
%%Trailer
showpage