home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEPLOY / USER.Z / printPackage.ps < prev    next >
Text File  |  1996-09-09  |  8KB  |  194 lines

  1. %!
  2. %
  3. %    printPackage.ps
  4. %    Application Kit
  5. %    Copyright (c) 1988-1996, NeXT Software, Inc.
  6. %    All rights reserved.
  7. %
  8.  
  9. /__NXdef{1 index where{pop pop pop}{def}ifelse}bind def
  10. /__NXbdef{1 index where{pop pop pop}{bind def}ifelse}bind def
  11. /UserObjects 10 array __NXdef
  12. /defineuserobject{
  13.     exch dup 1 add dup UserObjects length gt{
  14.         array dup 0 UserObjects putinterval
  15.         /UserObjects exch def
  16.     }{pop}ifelse UserObjects exch 3 -1 roll put
  17. }__NXbdef
  18. 0 0 defineuserobject
  19. 1 null defineuserobject
  20. /undefineuserobject{UserObjects exch null put}__NXbdef
  21. /execuserobject{UserObjects exch get exec}__NXbdef
  22. /__NXRectPath{4 2 roll moveto 1 index 0 rlineto
  23. 0 exch rlineto neg 0 rlineto closepath}__NXbdef
  24. /__NXProcessRectArgs{
  25.     1 index type /arraytype eq{
  26.         exch 0 4 2 index length 1 sub{
  27.             dup 3 add 1 exch{1 index exch get exch}for
  28.             5 1 roll 5 index exec
  29.         }for pop pop
  30.     }{exec}ifelse
  31. }__NXbdef
  32. /rectfill{gsave newpath {__NXRectPath fill} __NXProcessRectArgs grestore}__NXbdef
  33. /rectclip{newpath {__NXRectPath} __NXProcessRectArgs clip newpath}__NXbdef
  34. /rectstroke{
  35.     gsave newpath dup type /arraytype eq{dup length 6 eq}{false}ifelse{
  36.         {gsave __NXRectPath null concat stroke grestore}
  37.         dup length array cvx copy dup 2 4 -1 roll put __NXProcessRectArgs
  38.     }{{__NXRectPath stroke} __NXProcessRectArgs}ifelse grestore
  39. }__NXbdef
  40. /_NXLevel2 systemdict /languagelevel known {languagelevel 2 ge}{false}ifelse __NXdef
  41. /xyshow{
  42.     0 1 3 index length 1 sub{
  43.         currentpoint 4 index 3 index 1 getinterval show
  44.         3 index 3 index 2 mul 1 add get add exch
  45.         3 index    3 index 2 mul get add exch moveto pop
  46.     }for pop pop
  47. }__NXbdef
  48. /xshow{
  49.     0 1 3 index length 1 sub{
  50.         currentpoint 4 index 3 index 1 getinterval show
  51.         exch 3 index 3 index get add exch moveto pop
  52.     }for pop pop
  53. }__NXbdef
  54. /yshow{
  55.     0 1 3 index length 1 sub{
  56.         currentpoint 4 index 3 index 1 getinterval show
  57.         3 index 3 index get add moveto pop
  58.     }for pop pop
  59. }__NXbdef
  60. /arct{arcto pop pop pop pop}__NXbdef
  61. /setbbox{pop pop pop pop}__NXbdef
  62. /ucache{}__NXbdef
  63. /ucachestatus{mark 0 0 0 0 0}__NXbdef
  64. /setucacheparams{cleartomark}__NXbdef
  65. /uappend{systemdict begin cvx exec end}__NXbdef
  66. /ueofill{gsave newpath uappend eofill grestore}__NXbdef
  67. /ufill{gsave newpath uappend fill grestore}__NXbdef
  68. /ustroke{
  69.     gsave newpath dup length 6 eq
  70.     {exch uappend concat}{uappend}ifelse
  71.     stroke grestore
  72. }__NXbdef
  73. /__NXustrokepathMatrix dup where {pop pop}{matrix def}ifelse
  74. /ustrokepath{
  75.     newpath dup length 6 eq{
  76.         exch uappend __NXustrokepathMatrix currentmatrix exch concat
  77.         strokepath setmatrix
  78.     }{uappend strokepath}ifelse
  79. } __NXbdef
  80. /upath{
  81.     [exch {/ucache cvx}if pathbbox /setbbox cvx
  82.      {/moveto cvx}{/lineto cvx}{/curveto cvx}{/closepath cvx}pathforall]cvx
  83. } __NXbdef
  84. /setstrokeadjust{pop}__NXbdef
  85. /currentstrokeadjust{false}__NXbdef
  86. /selectfont{exch findfont exch
  87. dup type /arraytype eq {makefont}{scalefont}ifelse setfont}__NXbdef
  88. /_NXCombineArrays{
  89.     counttomark dup 2 add index dup length 3 -1 roll {
  90.         2 index length sub dup 4 1 roll 1 index exch 4 -1 roll putinterval exch
  91.     }repeat pop pop pop
  92. }__NXbdef
  93. /flushgraphics{}def
  94. /setwindowtype{pop pop}def
  95. /currentwindowtype{pop 0}def
  96. /setalpha{pop}def
  97. /currentalpha{1.0}def
  98. /hidecursor{}def
  99. /obscurecursor{}def
  100. /revealcursor{}def
  101. /setcursor{4 {pop}repeat}bind def
  102. /showcursor{}def
  103. /NextStepEncoding where not{
  104. /NextStepEncoding StandardEncoding 256 array copy def
  105. 0 [129/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/Ccedilla/Egrave
  106. /Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis
  107. /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/Ugrave/Uacute
  108. /Ucircumflex/Udieresis/Yacute/Thorn/mu/multiply/divide/copyright
  109. 176/registered 181/brokenbar 190/logicalnot 192/onesuperior 201/twosuperior
  110. 204/threesuperior 209/plusminus/onequarter/onehalf/threequarters/agrave
  111. /aacute/acircumflex/atilde/adieresis/aring/ccedilla/egrave/eacute
  112. /ecircumflex/edieresis/igrave 226/iacute 228/icircumflex/idieresis/eth
  113. /ntilde 236/ograve/oacute/ocircumflex/otilde/odieresis 242/ugrave/uacute
  114. /ucircumflex 246/udieresis/yacute 252/thorn/ydieresis]
  115. {dup type /nametype eq
  116.  {NextStepEncoding 2 index 2 index put pop 1 add}{exch pop}ifelse
  117. }forall pop
  118. /NextStepEncoding NextStepEncoding readonly def
  119. /_NXfstr 128 string dup 0 (_NX) putinterval def
  120. /_NXfindfont /findfont load def
  121. /findfont{
  122.  % Because we can never let NextStepEncoding get into
  123.  % SharedFontDirectory, we cannot reencode a font to NextStepEncoding
  124.  % if we are in shared mode.  So if currentshared is true,
  125.  % we call the normal findfont and return that
  126.  /currentshared where {pop currentshared} {false} ifelse
  127.  {_NXfindfont}
  128.  {dup _NXfstr 3 125 getinterval cvs length 3 add _NXfstr 0 3 -1 roll
  129.   getinterval cvn exch FontDirectory 2 index known 
  130.   {pop FontDirectory exch get}
  131.   {_NXfindfont dup /Encoding get StandardEncoding eq
  132.    {    dup length dict exch
  133.     {1 index /FID ne {2 index 3 1 roll put}{pop pop}ifelse}forall
  134.      dup /Encoding NextStepEncoding put definefont
  135.     }{exch pop} ifelse
  136.    }ifelse
  137.  }ifelse
  138. }bind def
  139. }{pop}ifelse
  140. /_NXImageString {/__NXImageString where{pop}{/__NXImageString 4000 string __NXdef}ifelse __NXImageString}__NXbdef
  141. /_NXDoImageOp{
  142.     3 dict begin /parr 5 array def 1 index{dup}{1}ifelse /chans exch def
  143.     chans 2 add 2 roll parr 0 chans getinterval astore pop
  144.     5 index 4 index mul 2 index{1 sub 8 idiv 1 add mul}{mul 1 sub 8 idiv 1 add}ifelse
  145.     4 index mul /totbytes exch def pop exch pop
  146.     gsave matrix invertmatrix concat 0.5 setgray 0 0 4 2 roll rectfill grestore
  147.     {0 1 chans 1 sub{parr exch get exec length totbytes exch sub /totbytes exch def}for totbytes 0 le{exit}if}loop end
  148. }__NXbdef
  149. /alphaimage{1 add _NXDoImageOp}def
  150. _NXLevel2{ 
  151.     /NXCalibratedRGBColorSpace where{pop}{
  152.         /NXCalibratedRGBColorSpace
  153.         {mark /NXCalibratedRGB /ColorSpace findresource exch pop}stopped
  154.         {cleartomark /NXCalibratedRGB[/CIEBasedABC 2 dict dup begin 
  155.         /MatrixLMN[.4124 .2126 .0193 .3576 .7152 .1192 .1805 .0722 .9505]def
  156.         /WhitePoint[.9505 1 1.089] def end] /ColorSpace defineresource}if def}ifelse
  157.     /nxsetrgbcolor{NXCalibratedRGBColorSpace setcolorspace setcolor}__NXbdef
  158.     /nxsetgray{dup dup nxsetrgbcolor}__NXbdef
  159.     /_NXCalibratedImage{exch{array astore dup length true}{false}ifelse
  160.         8 -1 roll{NXCalibratedRGBColorSpace setcolorspace}if
  161.         8 dict dup 9 1 roll begin /ImageType 1 def /MultipleDataSources exch def
  162.         currentcolorspace 0 get /Indexed eq{pop /Decode[0 2 6 index exp 1 sub]def}
  163.         {2 mul dup array /Decode exch def 1 sub 0 1 3 -1 roll{Decode exch dup 2 mod put}for}ifelse
  164.         /DataSource exch def /ImageMatrix exch def 
  165.         /BitsPerComponent exch def /Height exch def /Width exch def end image}__NXbdef
  166. } {
  167.     /setcmykcolor{
  168.         1.0 exch sub dup dup 6 -1 roll sub dup 0 lt{pop 0}if 5 1 roll
  169.         4 -1 roll sub dup 0 lt{pop 0}if 3 1 roll exch sub dup 0 lt{pop 0}if setrgbcolor}__NXbdef
  170.     /currentcmykcolor{currentrgbcolor 3{1.0 exch sub 3 1 roll}repeat 0}__NXbdef
  171.     /colorimage{2 copy 3 ne or{_NXDoImageOp}{4 index dup 8 ne exch 4 ne and{_NXDoImageOp}{
  172.         pop pop save 6 1 roll 12 dict begin/Proc exch def/Res 0 string def
  173.         /Alloc{2 index length mul 2 add dup 2 index load length gt{1.2 mul round cvi string def}{pop pop}ifelse}def
  174.         1 index 8 eq{/Unpack{.34 Alloc}def}{
  175.             /Wid 4 index 3 mul def exch pop 8 exch/Str1 0 string def/Lim Wid def
  176.             /Unpack{.67 Alloc/Str1 2 Alloc 0 exch Lim exch
  177.                 {dup -4 bitshift 17 mul Str1 exch 4 index exch put 15 and 17 mul Str1 exch 3 index 1 add exch put
  178.                 2 sub dup 0 le{0 lt Wid exch{exch 1 sub exch}if}if exch 2 add exch
  179.                 }forall/Lim exch def Str1 exch 0 exch getinterval
  180.             }def
  181.         }ifelse
  182.         /Ops[{.3 mul add 1}{.59 mul add 2}{.11 mul add round cvi Res exch 2 index exch put 1 add 0.0 0}]def/Val 0.0 def/Phase 0 def
  183.         {0 Val Phase Proc/Res Unpack{exch Ops exch get exec}forall/Phase exch def/Val exch def Res exch 0 exch getinterval}
  184.         image end restore}ifelse}ifelse
  185.     }__NXbdef
  186.     /nxsetrgbcolor{setrgbcolor}__NXbdef /nxsetgray{setgray}__NXbdef
  187.     /setpattern{pop .5 setgray}__NXbdef
  188.     /_NXCalibratedImage{dup 1 eq {pop pop image}{colorimage}ifelse pop}__NXbdef
  189. } ifelse
  190. /_NXSetCMYKOrRGB where{pop}{
  191.     mark{systemdict /currentwindow get exec}stopped
  192.     {{pop pop pop setcmykcolor}}{{nxsetrgbcolor pop pop pop pop}}ifelse /_NXSetCMYKOrRGB exch def cleartomark
  193. }ifelse
  194.