home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 February / INTERNET88.ISO / pc / software / windows / bits / pdf995 / data1.cab / Program_Executable_Files / res / traceop.ps < prev    next >
Encoding:
Text File  |  2001-12-08  |  3.0 KB  |  87 lines

  1. %    Copyright (C) 1992, 1993, 1994, 1999 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of GNU Ghostscript.
  3. % GNU Ghostscript is distributed in the hope that it will be useful, but
  4. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  5. % to anyone for the consequences of using it or for whether it serves any
  6. % particular purpose or works at all, unless he says so in writing.  Refer
  7. % to the GNU General Public License for full details.
  8. % Everyone is granted permission to copy, modify and redistribute GNU
  9. % Ghostscript, but only under the conditions described in the GNU General
  10. % Public License.  A copy of this license is supposed to have been given
  11. % to you along with GNU Ghostscript so you can know your rights and
  12. % responsibilities.  It should be in a file named COPYING.  Among other
  13. % things, the copyright notice and this notice must be preserved on all
  14. % copies.
  15.  
  16. % $RCSfile: traceop.ps,v $ $Revision: 1.2.2.1 $
  17. % Trace individual operators or procedures.
  18. % <opref> is <opname> or <opname> <dict>
  19. %    (dict defaults to dict where op is currently defined, if writable;
  20. %    otherwise uses userdict)
  21. % <opref> traceop prints vmem usage before;
  22. % <opref> <numargs|preproc> prints arguments or runs proc before;
  23. % <opref> <numargs|preproc> <numresults|postproc>
  24. %    also prints results or runs proc after.
  25. % If traceflush is true, flush the output after each printout.
  26. /traceflush true def
  27.  
  28. currentpacking true setpacking
  29. .currentglobal true .setglobal
  30.  
  31. % Define the default "before" action
  32. /tracebefore { vmstatus 3 traceprint pop pop pop } def
  33.  
  34. % Define the default "after" action
  35. /traceafter { } def
  36.  
  37. /traceprint {
  38.   dup type /integertype eq {
  39.     1 sub -1 0 { ( ) print index ==only } for
  40.   } {
  41.     exec
  42.   } ifelse
  43. } bind def
  44. /traceend {
  45.   traceflush { flush } if
  46. } bind def
  47. /traceop {
  48.   userdict begin
  49.   dup type dup /nametype eq exch /dicttype eq or { { tracebefore } } if
  50.   1 index type dup /nametype eq exch /dicttype eq or { { traceafter } } if
  51.   /.tpost exch def /.tpre exch def
  52.   dup type /dicttype ne {
  53.     dup where not { userdict 1 index {} put userdict } if
  54.   } if
  55.   dup dup wcheck not {
  56.     (Warning: substituting userdict for non-writable dictionary.) =
  57.     pop userdict
  58.   } if
  59.   /.tddict exch def   /.tdict exch def   /.tname exch cvlit def
  60.   .currentglobal [
  61.   .tname /=only cvx ( ) /print cvx
  62.     /.tpre load /traceprint cvx /traceend cvx
  63.     .tdict .tname get /.tdef 1 index cvlit def
  64.     dup xcheck {
  65.       dup type dup /arraytype eq exch /packedarraytype eq or {
  66.     /exec cvx
  67.       } if
  68.     } if
  69.     /.tpost load /traceprint cvx () /= cvx /traceend cvx
  70.   .tdef gcheck /.tpre load gcheck and /.tpost load gcheck and .setglobal
  71.   ] cvx
  72.   .tdef type /operatortype eq {
  73.     .tname exch .makeoperator
  74.   } if
  75.   exch .setglobal
  76.   .tddict exch .tname exch put
  77.   end        % userdict
  78. } bind def
  79. /tracebind /bind load def    % in case someone wants to put it back
  80. /bind { } def        % disable
  81.  
  82. .setglobal
  83. setpacking
  84.