home *** CD-ROM | disk | FTP | other *** search
/ jppd.dyndns.org / jppd.dyndns.org.tar / jppd.dyndns.org / QUERYPRO / Impressora_PDF / converter.exe / GPLGS / traceop.ps < prev    next >
Text File  |  2002-02-22  |  3KB  |  84 lines

  1. %    Copyright (C) 1992, 1993, 1994, 1999 Aladdin Enterprises.  All rights reserved.
  2. % This software is provided AS-IS with no warranty, either express or
  3. % implied.
  4. % This software is distributed under license and may not be copied,
  5. % modified or distributed except as expressly authorized under the terms
  6. % of the license contained in the file LICENSE in this distribution.
  7. % For more information about licensing, please refer to
  8. % http://www.ghostscript.com/licensing/. For information on
  9. % commercial licensing, go to http://www.artifex.com/licensing/ or
  10. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
  12.  
  13. % $Id: traceop.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  14. % Trace individual operators or procedures.
  15. % <opref> is <opname> or <opname> <dict>
  16. %    (dict defaults to dict where op is currently defined, if writable;
  17. %    otherwise uses userdict)
  18. % <opref> traceop prints vmem usage before;
  19. % <opref> <numargs|preproc> prints arguments or runs proc before;
  20. % <opref> <numargs|preproc> <numresults|postproc>
  21. %    also prints results or runs proc after.
  22. % If traceflush is true, flush the output after each printout.
  23. /traceflush true def
  24.  
  25. currentpacking true setpacking
  26. .currentglobal true .setglobal
  27.  
  28. % Define the default "before" action
  29. /tracebefore { vmstatus 3 traceprint pop pop pop } def
  30.  
  31. % Define the default "after" action
  32. /traceafter { } def
  33.  
  34. /traceprint {
  35.   dup type /integertype eq {
  36.     1 sub -1 0 { ( ) print index ==only } for
  37.   } {
  38.     exec
  39.   } ifelse
  40. } bind def
  41. /traceend {
  42.   traceflush { flush } if
  43. } bind def
  44. /traceop {
  45.   userdict begin
  46.   dup type dup /nametype eq exch /dicttype eq or { { tracebefore } } if
  47.   1 index type dup /nametype eq exch /dicttype eq or { { traceafter } } if
  48.   /.tpost exch def /.tpre exch def
  49.   dup type /dicttype ne {
  50.     dup where not { userdict 1 index {} put userdict } if
  51.   } if
  52.   dup dup wcheck not {
  53.     (Warning: substituting userdict for non-writable dictionary.) =
  54.     pop userdict
  55.   } if
  56.   /.tddict exch def   /.tdict exch def   /.tname exch cvlit def
  57.   .currentglobal [
  58.   .tname /=only cvx ( ) /print cvx
  59.     /.tpre load /traceprint cvx /traceend cvx
  60.     .tdict .tname get /.tdef 1 index cvlit def
  61.     dup xcheck {
  62.       dup type dup /arraytype eq exch /packedarraytype eq or {
  63.     /exec cvx
  64.       } if
  65.     } if
  66.     /.tpost load /traceprint cvx () /= cvx /traceend cvx
  67.   .tdef gcheck /.tpre load gcheck and /.tpost load gcheck and .setglobal
  68.   ] cvx
  69.   .tdef type /operatortype eq {
  70.     .tname exch .makeoperator
  71.   } if
  72.   exch .setglobal
  73.   .tddict exch .tname exch put
  74.   end        % userdict
  75. } bind def
  76. /tracebind /bind load def    % in case someone wants to put it back
  77. /bind { } def        % disable
  78.  
  79. .setglobal
  80. setpacking
  81.