星火微课系统客户端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

traceop.ps 2.7KB

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