Mercurial > emacs
annotate etc/ps-prin0.ps @ 28342:9761cf2351fa
(enum re_opcode_t): New opcode on_failure_jump_nastyloop.
(print_partial_compiled_pattern, re_compile_fastmap): Handle new opcode.
(regex_compile): Use on_failure_jump_nastyloop for non-greedy loops.
(re_match_2_internal): Add code for on_failure_jump_nastyloop when
executing it as well as when popping it off the stack to find infinite
loops in non-greedy repetition operators.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 26 Mar 2000 23:05:51 +0000 |
parents | 0bb132ece3a9 |
children | 15c0a66a4a8b |
rev | line source |
---|---|
28155 | 1 % === BEGIN ps-print prologue 0 |
2 | |
3 %%BeginProcSet: ErrorHandler | |
4 % Downloaded Error Break-page handler | |
5 % Adapted from: | |
6 % PostScript Language Program Design, | |
7 % Adobe Systems Incorporated. | |
8 % Appendix A, pages 217-219 | |
9 | |
10 /ps$brkpage where{pop} | |
11 { | |
12 /ps$brkpage 64 dict def | |
13 ps$brkpage begin | |
14 /tx 0 def /ty 0 def /toy 0 def /tox 0 def | |
15 /prnt{ | |
16 dup type /stringtype ne{=string cvs}if | |
17 dup length 6 mul | |
18 /tx exch def /ty 10 def | |
19 currentpoint /toy exch def /tox exch def | |
20 1 setgray newpath | |
21 tox toy 2 sub moveto | |
22 0 ty rlineto tx 0 rlineto | |
23 0 ty neg rlineto | |
24 closepath fill | |
25 tox toy moveto 0 setgray show | |
26 }bind def | |
27 /nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def | |
28 /=={/cp 0 def typeprint nl}def | |
29 /typeprint{dup type dup currentdict exch known{exec}{unknowntype}ifelse}readonly def | |
30 /lmargin 72 def | |
31 /rmargin 72 def | |
32 /tprint{ | |
33 dup length cp add rmargin gt{nl /cp 0 def}if | |
34 dup length cp add /cp exch def | |
35 prnt | |
36 }readonly def | |
37 /cvsprint{=string cvs tprint( )tprint}readonly def | |
38 /unknowntype{exch pop cvlit(??)tprint cvsprint}readonly def | |
39 /integertype{cvsprint}readonly def | |
40 /realtype{cvsprint}readonly def | |
41 /booleantype{cvsprint}readonly def | |
42 /operatortype{(//)tprint cvsprint}readonly def | |
43 /marktype{pop(-mark-)tprint}readonly def | |
44 /dicttype{pop(-dictionary-)tprint}readonly def | |
45 /nulltype{pop(-null-)tprint}readonly def | |
46 /filetype{pop(-filestream-)tprint}readonly def | |
47 /savetype{pop(-savelevel-)tprint}readonly def | |
48 /fonttype{pop(-fontid-)tprint}readonly def | |
49 /nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def | |
50 /stringtype{ | |
51 dup rcheck | |
52 {(\()tprint tprint(\))tprint} | |
53 {pop(-string-)tprint}ifelse}readonly def | |
54 /arraytype{ | |
55 dup rcheck | |
56 {dup xcheck | |
57 {({)tprint{typeprint}forall(})tprint} | |
58 {([)tprint{typeprint}forall(])tprint}ifelse} | |
59 {pop(-array-)tprint}ifelse}readonly def | |
60 /packedarraytype{ | |
61 dup rcheck | |
62 {dup xcheck | |
63 {({)tprint{typeprint}forall(})tprint} | |
64 {([)tprint{typeprint}forall(])tprint}ifelse} | |
65 {pop(-packedarray-)tprint}ifelse}readonly def | |
66 /courier /Courier findfont 10 scalefont def | |
67 /OLDhandleerror errordict /handleerror get def | |
68 end %ps$brkpage | |
69 | |
70 /handleerror{ | |
71 systemdict begin $error begin ps$brkpage begin | |
72 newerror | |
73 {/newerror false store vmstatus pop pop 0 ne{grestoreall}if | |
74 initgraphics | |
75 ErrorMessage 1 and 0 ne{ % print on paper | |
76 courier setfont lmargin 720 moveto | |
77 (# ERROR: )prnt errorname prnt nl | |
78 (# OFFENDING COMMAND: )prnt /command load prnt | |
79 $error /ostack known | |
80 {nl nl(# STACK:)prnt nl nl $error /ostack get aload length{==}repeat}if | |
81 $error /errorinfo known | |
82 {nl nl(# ERRORINFO:)prnt nl nl $error /errorinfo get aload length{==}repeat}if | |
83 systemdict /showpage get exec}if | |
84 ErrorMessage 2 and 0 ne{ % send back to printing system | |
85 (\%\%[ Error: )print errorname =print | |
86 (; OffendingCommand: )print/command load =print | |
87 $error /errorinfo known | |
88 {(; ErrorInfo:)print $error /errorinfo get aload length{( )=print =print}repeat}if | |
89 ( ]\%\%)= flush | |
90 (\%\%[ Rest of job is ignored ]\%\%)= flush}if | |
91 /newerror true store}if | |
92 end end end | |
93 stop | |
94 } % handleerror | |
95 dup 0 systemdict put % replace name by actual dict object | |
96 dup 4 ps$brkpage put % replace name by dict object | |
97 bind readonly | |
98 | |
99 errordict 3 1 roll put % put proc in errordict as /handleerror | |
100 }ifelse | |
101 %%EndProcSet | |
102 | |
28265
0bb132ece3a9
Define command only for language level 1.
Gerd Moellmann <gerd@gnu.org>
parents:
28167
diff
changeset
|
103 gs_languagelevel 1 eq{ % operators for language level 2 only |
28155 | 104 /<<{mark}bind def |
105 />>{counttomark 2 idiv dup dict begin{def}repeat pop currentdict end}bind def | |
106 /setpagedevice{pop}bind def | |
28167
cb25a24ec3e1
Change /setduplexmode, /settumble, add /packedarray.
Gerd Moellmann <gerd@gnu.org>
parents:
28155
diff
changeset
|
107 /packedarray{array astore readonly}bind def |
28155 | 108 }if |
109 | |
28167
cb25a24ec3e1
Change /setduplexmode, /settumble, add /packedarray.
Gerd Moellmann <gerd@gnu.org>
parents:
28155
diff
changeset
|
110 % device dependent operators |
cb25a24ec3e1
Change /setduplexmode, /settumble, add /packedarray.
Gerd Moellmann <gerd@gnu.org>
parents:
28155
diff
changeset
|
111 |
28155 | 112 /setduplexmode where{pop} |
28167
cb25a24ec3e1
Change /setduplexmode, /settumble, add /packedarray.
Gerd Moellmann <gerd@gnu.org>
parents:
28155
diff
changeset
|
113 {/setduplexmode /duplexmode where{pop/duplexmode}{/pop}ifelse load def}ifelse |
28155 | 114 |
115 /settumble where{pop} | |
28167
cb25a24ec3e1
Change /setduplexmode, /settumble, add /packedarray.
Gerd Moellmann <gerd@gnu.org>
parents:
28155
diff
changeset
|
116 {/settumble /tumble where{pop/tumble}{/pop}ifelse load def}ifelse |
28155 | 117 |
118 % === END ps-print prologue 0 |