%!PS-Adobe-2.0
%%Subject: PostScript prolog for converting PostScript files into
%%Subject: a canonical EPS form, acceptable by such programs as
%%Subject: CorelDRAW!(R), Adobe Illustrator(TM) and Fontographer(R).
%%Copyright: (c) BOP s.c. 1993--1999
%%Public domain
%%Version: 0.54
%%LastUpdate: Wednesday, January 5th, 2000
%%BeginProcSet: ps_conv.ps
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Authors: P. Pianowski and B. Jackowski
% Address: BOP s.c., ul. Piastowska 70, 80-363 Gda\'nsk, Poland
%
[email protected]
% History:
% ver. 0.50, Friday, October 27th, 1995:
% * first official public domain release
% October 30th, 1995:
% * GC.BAT and GC.PAR touched
% ver. 0.52, Wednesday, April 10th, 1996
% * oper_kind added to degenerated paths (i.e. containing only
% `m' operation)
% * paper format commands neutralized
% * new parameter called PREC added; decimal numbers are printed with
% precision PREC (default PREC=3; max. 3 digits follow period)
% ver. 0.53, Friday, November 8th, 1996
% * the bug in `print_rounded' fixed: numbers of the form `0.0123' i.e.
% with leading zeros following the period were badly printed.
% ver. 0.54, Wednesday, January 5th, 2000
% * the file `gc_head' has been improved, paths beeng eofilled
% and eoclipped are closed explicity
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/ExportDict 100 dict def ExportDict begin
%
% command line parameters:
systemdict /SCALE known {/SCALE SCALE def} {/SCALE 10 def} ifelse
systemdict /XOFF known {/XOFF XOFF def} {/XOFF 0 def} ifelse
systemdict /YOFF known {/YOFF YOFF def} {/YOFF 0 def} ifelse
systemdict /DASHED known {/DASHED true def} {/DASHED false def} ifelse
systemdict /DOS known
{/print_new_line {<0D0A> print} def}
{/print_new_line {<0A> print} def} ifelse
systemdict /PREC known {/PREC PREC def} {/PREC 3 def} ifelse
% end of parameters
%
statusdict begin
/letter {} def
/note {} def
/legal {} def
/a3 {} def
/a4 {} def
/a5 {} def
/a6 {} def
/b4 {} def
/b5 {} def
/flsa {} def
/flse {} def
/halfletter {} def
/11x17 {} def
/ledger {} def
/setpageparams {pop pop pop pop} def
/setpage {pop pop pop} def
end
%
/val_str 20 string def
/epsilon 0.001 def
SCALE dup matrix scale setmatrix
/curr_matr matrix currentmatrix def
/default_matr curr_matr def
/xl 100000 def
/yl 100000 def
/xh -100000 def
/yh -100000 def
/save_bb {ExportDict begin xl yl xh yh end} def
/restore_bb {ExportDict begin /yh exch def /xh exch def
/yl exch def /xl exch def end} def
/ori_restore /restore load def
/restore {ExportDict begin save_bb 5 -1 roll ori_restore restore_bb end} def
%
% <x> <y> set_bb <x> <y>
/set_bb {ExportDict begin
dup yl lt {dup /yl exch def} if
dup yh gt {dup /yh exch def} if
exch
dup xl lt {dup /xl exch def} if
dup xh gt {dup /xh exch def} if
exch
end} def
%
/accuracy 10 PREC neg exp def
/accuracy_mask (00000000000000000000000000000000000000000000000)
0 PREC 1 add getinterval def
/print_rounded {ExportDict begin
dup abs 0.000001 lt {pop (0) print} {accuracy div round
dup abs 16#7FFFFFFF gt {pop (INTEGER OUT of RANGE!\n) ori_print quit} if
cvi
/minus_sign false def dup 0 lt {neg /minus_sign true def} if
%
dup /int_to_pull exch def /dig_to_pull 0 def
{int_to_pull 0 eq {exit} if
/mod_to_pull int_to_pull 10 mod def
mod_to_pull 0 eq {/dig_to_pull dig_to_pull 1 add def
/int_to_pull int_to_pull 10 idiv def} {exit} ifelse} loop
%
/fractional_dig PREC dig_to_pull sub 0 max def
minus_sign {(-) print} if
val_str cvs
%
% dup length PREC le {/leading_zeros accuracy_mask def %% !! ERROR
dup length PREC le {/leading_zeros PREC 1 add string def
leading_zeros 0 accuracy_mask putinterval
%
leading_zeros exch
dup length PREC 1 add exch sub exch putinterval leading_zeros} if
dup dup length PREC sub 0 exch getinterval print
fractional_dig 0 eq {pop} {(.) print
dup length PREC sub fractional_dig getinterval
print} ifelse} ifelse end} def
/print_scaled_x {ExportDict begin SCALE div XOFF sub print_rounded end} def
/print_scaled_y {ExportDict begin SCALE div YOFF sub print_rounded end} def
%
% <s0>..<sn> <r> n_print
/n_print {ExportDict begin -1 1 {-1 roll print_rounded ( ) print} for end} def
%
/p_trans {ExportDict begin /r_param exch def
r_param -1 roll dup /trans_x exch def r_param 1 roll
/r_param r_param 1 sub def
r_param -1 roll dup /trans_y exch def r_param 1 roll
trans_x trans_y curr_matr transform
set_bb
exch
print_scaled_x ( ) print
print_scaled_y ( ) print
end} def
%
/check_point {ExportDict begin
x_1 curr_x sub dup mul
y_1 curr_y sub dup mul add sqrt epsilon ge
end} def
%
/ori_currentcmykcolor /currentcmykcolor load def
/ori_gsave /gsave load def
/ori_grestore /grestore load def
/ori_moveto /moveto load def
/ori_curveto /curveto load def
/ori_lineto /lineto load def
/ori_closepath /closepath load def
%
/my_moveto {ExportDict begin
matrix currentmatrix curr_matr ne {/curr_matr matrix currentmatrix def} if
/y_start exch def
/x_start exch def
/curr_x x_start def
/curr_y y_start def
oper_to_send {oper_kind dup (s) eq {pop (S)} if print print_new_line} if
/oper_to_send true def
curr_x curr_y
2 p_trans
(m) print print_new_line
ori_moveto
end} def
/my_curveto {ExportDict begin
/y_1 exch def /x_1 exch def
check_point
{
x_1 y_1
6 p_trans
4 p_trans
2 p_trans
(c) print print_new_line
/curr_x x_1 def
/curr_y y_1 def
}
{x_1 y_1} ifelse
ori_curveto
end} def
/my_lineto {ExportDict begin
/y_1 exch def /x_1 exch def
check_point
{
x_1 y_1
2 p_trans
(l) print print_new_line
/curr_x x_1 def
/curr_y y_1 def
}
{x_1 y_1} ifelse
ori_lineto
end} def
/my_closepath {ExportDict begin
curr_x curr_y y_start ne exch x_start ne or
{x_start y_start 2 p_trans (l) print print_new_line ori_lineto} if
oper_kind print print_new_line
/oper_to_send false def
ori_closepath
end} def
/gsave {ExportDict begin (q) print print_new_line ori_gsave end} def
/grestore {ExportDict begin(Q) print print_new_line ori_grestore end} def
%
/show {ExportDict begin
ori_gsave
currentfont [1 0 0 1 0 0] makefont setfont
false charpath currentpoint
(*u) print print_new_line
ori_currentcmykcolor 4 n_print (k) print print_new_line
/oper_kind (f) def /oper_to_send false def
{my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall
oper_to_send {oper_kind print print_new_line} if
(*U) print print_new_line
ori_grestore
newpath moveto
end} def
/eofill {ExportDict begin
ori_gsave
closepath
(*u) print print_new_line
ori_currentcmykcolor 4 n_print (k) print print_new_line
/oper_kind (f) def /oper_to_send false def
{my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall
oper_to_send {oper_kind print print_new_line} if
(*U) print print_new_line
ori_grestore newpath
end} def
/eoclip {ExportDict begin
ori_gsave
closepath
(*u) print print_new_line
/oper_kind (h W n) def /oper_to_send false def
{my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall
oper_to_send {oper_kind print print_new_line} if
(*U) print print_new_line
ori_grestore newpath
end} def
/local_transform{ExportDict begin 0
default_matr matrix invertmatrix matrix currentmatrix matrix concatmatrix
aload pop pop pop 0 0 6 array astore transform
dup mul exch dup mul add sqrt
end} def
/print_local_transform{ExportDict begin local_transform print_rounded end} def
/n_print_local {ExportDict begin
-1 1 {-1 roll print_local_transform ( ) print} for end} def
/stroke {ExportDict begin
ori_gsave
(*u) print print_new_line
currentlinewidth print_local_transform ( w ) print
currentlinejoin print_rounded ( j ) print
currentlinecap print_rounded ( J ) print
currentmiterlimit local_transform dup 1 lt {pop 1} if print_rounded
( M ) print
DASHED {
print_new_line
currentdash exch dup length /dashlength exch def
aload pop ([) print dashlength n_print_local (] ) print print_rounded
( d) print} if
print_new_line
ori_currentcmykcolor 4 n_print (K) print print_new_line
/oper_kind (s) def /oper_to_send false def
{my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall
oper_to_send {(S) print print_new_line} if
(*U) print print_new_line
ori_grestore newpath
end} def
/fill /eofill load def
/clip /eoclip load def
%
/out_file (!ps_exp1.ps) (w) file def
/showpage {ExportDict begin
out_file flushfile
out_file closefile
/out_file (!ps_exp2.ps) (w) file def
(%!PS-Adobe-2.0 EPSF-2.0) print print_new_line
(%%Creator: GhostScript rev. ) print revision print_rounded print_new_line
(%%BoundingBox: ) print
xl print_scaled_x ( ) print
yl print_scaled_y ( ) print
xh print_scaled_x ( ) print
yh print_scaled_y print_new_line
(%%EndComments) print print_new_line
out_file flushfile
out_file closefile
quit
end} def
/ori_print /print load def
/print {ExportDict begin out_file exch writestring end} def
end
%%EndProcSet: ps_conv.ps
ExportDict begin