Commit | Line | Data |
---|---|---|
24044d5d WJ |
1 | % Copyright (C) 1992 Aladdin Enterprises. All rights reserved. |
2 | % Distributed by Free Software Foundation, Inc. | |
3 | % | |
4 | % This file is part of Ghostscript. | |
5 | % | |
6 | % Ghostscript is distributed in the hope that it will be useful, but | |
7 | % WITHOUT ANY WARRANTY. No author or distributor accepts responsibility | |
8 | % to anyone for the consequences of using it or for whether it serves any | |
9 | % particular purpose or works at all, unless he says so in writing. Refer | |
10 | % to the Ghostscript General Public License for full details. | |
11 | % | |
12 | % Everyone is granted permission to copy, modify and redistribute | |
13 | % Ghostscript, but only under the conditions described in the Ghostscript | |
14 | % General Public License. A copy of this license is supposed to have been | |
15 | % given to you along with Ghostscript so you can know your rights and | |
16 | % responsibilities. It should be in a file named COPYING. Among other | |
17 | % things, the copyright notice and this notice must be preserved on all | |
18 | % copies. | |
19 | ||
20 | % Trace individual operators or procedures. | |
21 | % <opref> is <opname> or <opname> <dict> (dict defaults to userdict). | |
22 | % <opref> traceop prints vmem usage before; | |
23 | % <opref> <numargs|preproc> prints arguments or runs proc before; | |
24 | % <opref> <numargs|preproc> <numresults|postproc> | |
25 | % also prints results or runs proc after. | |
26 | % If traceflush is true, flush the output after each printout. | |
27 | /traceflush true def | |
28 | ||
29 | % Define the default "before" action | |
30 | /tracebefore { vmstatus 3 traceprint pop pop pop } def | |
31 | ||
32 | % Define the default "after" action | |
33 | /traceafter { } def | |
34 | ||
35 | /traceprint | |
36 | { dup type /integertype eq | |
37 | { 1 sub -1 0 { ( ) print index ==only } for } | |
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 | /.tdict exch def /.tname exch def | |
53 | .tdict dup systemdict eq { pop userdict } if /.tddict exch def | |
54 | [ .tname /=only cvx ( ) /print cvx | |
55 | /.tpre load /traceprint cvx /traceend cvx | |
56 | .tdict .tname get | |
57 | dup xcheck | |
58 | { dup type dup /arraytype eq exch /packedarraytype eq or | |
59 | { /exec cvx | |
60 | } if | |
61 | } if | |
62 | /.tpost load /traceprint cvx (\n) /print cvx /traceend cvx | |
63 | ] cvx .tddict exch .tname exch put end | |
64 | } bind def | |
65 | /bind { } def % disable |