home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / clipart / gs22.zip / TRACEOP.PS < prev    next >
Text File  |  1991-05-25  |  928b  |  30 lines

  1. % Trace individual operators.
  2. % <opname> traceop prints vmem usage
  3. % <opname> <numargs|preproc> prints arguments or runs proc before
  4. % <opname> <numargs|preproc> <numresults|postproc>
  5. %    also prints results or runs proc after
  6.  
  7. % Define the default "before" action
  8. /tracebefore { vmstatus 3 .traceprint } def
  9.  
  10. % Define the default "after" action
  11. /traceafter { } def
  12.  
  13. /.traceprint
  14.  { dup type /integertype eq
  15.     { 1 sub -1 0 { ( ) print index ==only } for }
  16.     { exec }
  17.    ifelse
  18.  } bind def
  19. /traceop
  20.  { userdict begin
  21.    dup type /nametype eq { { tracebefore } } if
  22.    1 index type /nametype eq { { traceafter } } if
  23.    /.tpost exch def /.tpre exch def /.tname exch def
  24.    [ .tname /=only cvx ( ) /print cvx
  25.      /.tpre load /.traceprint cvx systemdict .tname /get cvx /exec cvx
  26.      /.tpost load /.traceprint cvx (\n) /print cvx
  27.    ] cvx .tname exch def end
  28.  } bind def
  29. /bind { } def        % disable
  30.