home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
printers
/
utilities
/
redaktu
/
redaktu.ps
< prev
next >
Wrap
Text File
|
1991-02-14
|
17KB
|
495 lines
%!PS-Adobe 2.0 for PixelScript interpreter on the Amiga 2000
%%Title: Redaktu.ps
%%Creator: John Wesley Starling
%%CreationDate: 26 Jan 91
%%BoundingBox: Not Applicable, edits a file, nothing is drawn.
%%Comments: Send suggestions & improvements to creator at his home %%address: 224 Rose Place, Kalamazoo MI 49001-2617 USA
%%EndComments
%=========================================
%==== THESE ARRAYS ARE TO BE USED IN =====
%==== FILES HAVING EITHER .myps =====
%==== OR .mytxt SUFFIXES =====
%==== fill them in with your own =====
%==== definitions =====
%=========================================
/string1
(
/newdeffont {exch dup /grando exch def exch deffont} def
/d {grando 1000 div mul} def
/D {grando 750 div mul} def
) def
% newdeffont, d and D give you variables to use in creating characters
% that will size themselves automatically in relation to the size of the
% last defined font. See how I used them in my definitions for the various
% superscript characters in similar set described below.
/string2 () def
/string99 () def
/prologArray [ string1 string2 string99 ] def
% PixelScript has a bug that will truncate long strings sent with the
% writestring operator. Breaking up your prolog insert into smaller
% strings will overcome this.
/nonPrologArray [ (remove) (insert) ] def
/otherArray [ (remove) (insert) ] def
% PixelScript has another bug that will cause a series of odd control-2
% characters to be present at the beginning of every string sent to your
% text file. These characters look like this... but Pro Page
% just ignores them when importing text. So I did too.
%====================================================
%===== DEFINE STRINGS FOR INSERTION INTO PROLOG =====
%===== AND DEFINE SEARCH/REPLACE ARRAY =====
%===== FOR USE IN .ps FILES ONLY =====
%====================================================
/fadeno1 (
/newdeffont {exch dup /grando exch def exch deffont} def
/d {grando 1000 div mul} def
/D {grando 750 div mul} def
/uSuper
{ gsave currentpoint translate newpath
-91 d -670 d moveto
-157 d -470 d -387 d -470 d -453 d -670 d curveto
-427 d -670 d lineto
-357 d -550 d -187 d -550 d -118 d -670 d curveto
closepath fill grestore} def
/USuper
{ gsave currentpoint translate newpath
-91 D -700 D moveto
-157 D -500 D -387 D -500 D -453 D -700 D curveto
-427 D -700 D lineto
-357 D -580 D -187 D -580 D -118 D -700 D curveto
closepath fill grestore} def
/SSuper
{ gsave currentpoint translate newpath
-51 D -565 D moveto -190 D -700 D lineto
-230 D -700 D lineto -369 D -565 D lineto
-349 D -555 D lineto -210 D -630 D lineto
-71 D -555 D lineto
closepath fill grestore} def ) def
/fadeno2 (
/sSuper
{ gsave currentpoint translate newpath
-50 d -535 d moveto -185 d -670 d lineto
-215 d -670 d lineto -350 d -535 d lineto
-325 d -525 d lineto -200 d -600 d lineto
-75 d -525 d lineto
closepath fill grestore} def
/CSuper
{ gsave currentpoint translate newpath
-51 D -560 D moveto -210 D -700 D lineto
-250 D -700 D lineto -413 D -560 D lineto
-387 D -550 D lineto -230 D -630 D lineto
-81 D -550 D lineto
closepath fill grestore} def
/cSuper
{ gsave currentpoint translate newpath
-36 d -530 d moveto -190 d -670 d lineto
-220 d -670 d lineto -388 d -530 d lineto
-362 d -520 d lineto -205 d -600 d lineto
-66 d -520 d lineto
closepath fill grestore} def ) def
/fadeno3 (
/GSuper
{ gsave currentpoint translate newpath
-81 D -560 D moveto -250 D -700 D lineto
-290 D -700 D lineto -459 D -560 D lineto
-429 D -550 D lineto -270 D -630 D lineto
-111 D -540 D lineto
closepath fill grestore} def
/gSuper
{ gsave currentpoint translate newpath
-91 d -535 d moveto -230 d -670 d lineto
-270 d -670 d lineto -409 d -535 d lineto
-389 d -525 d lineto -250 d -600 d lineto
-121 d -525 d lineto
closepath fill grestore} def
/JSuper
{ gsave currentpoint translate newpath
12 D -560 D moveto -105 D -700 D lineto
-135 D -700 D lineto -252 D -560 D lineto
-240 D -550 D lineto -120 D -630 D lineto
0 D -550 D lineto
closepath fill grestore} def ) def
/fadeno4 (
/jSuper
{ gsave currentpoint translate newpath
12 d -530 d moveto -90 d -720 d lineto
-150 d -720 d lineto -252 d -530 d lineto
closepath 1 setgray fill
newpath 0 setgray
12 d -530 d moveto -107 d -670 d lineto
-133 d -670 d lineto -252 d -530 d lineto
-233 d -520 d lineto -120 d -600 d lineto
-7 d -520 d lineto
closepath fill grestore} def
/HSuper
{ gsave currentpoint translate newpath
-51 D -560 D moveto -235 D -700 D lineto
-295 D -700 D lineto -479 D -560 D lineto
-449 D -550 D lineto -265 D -610 D lineto
-81 D -550 D lineto
closepath fill grestore} def
/hSuper
{ gsave currentpoint translate newpath
-81 d -755 d moveto -220 d -890 d lineto
-260 d -890 d lineto -399 d -755 d lineto
-379 d -745 d lineto -240 d -820 d lineto
-101 d -745 d lineto
closepath fill grestore} def
%% EndProlog
) def % string entry for psArray defined
/fadenArray [ fadeno1 fadeno2 fadeno3 fadeno4 ] def
/psArray [ ((c) show cSuper\n) ((c) sho) ((C) show CSuper\n) ((C) sho)
((u) show uSuper\n) ((u) sho) ((U) show USuper\n) ((U) sho)
((j) show jSuper\n) ((j) sho) ((J) show JSuper\n) ((J) sho)
((g) show gSuper\n) ((g) sho) ((G) show GSuper\n) ((G) sho)
((h) show hSuper\n) ((h) sho) ((H) show HSuper\n) ((H) sho)
((s) show sSuper\n) ((s) sho) ((S) show SSuper\n) ((S) sho)
] def
%=======================================================
%===== DEFINE THE ARRAY OF SEARCH/REPLACE STRINGS =====
%===== FOR USE IN .txt FILES ONLY =====
%=======================================================
/txtArray [ (q) (\\ls<1>c\\ls<0>) (Q) (\\ls<1>C\\ls<0>)
([) (\\ls<1>g\\ls<0>) ({) (\\ls<1>G\\ls<0>)
(]) (\\ls<1>h\\ls<0>) (}) (\\ls<1>H\\ls<0>)
(y) (\\ls<1>j\\ls<0>) (Y) (\\ls<1>J\\ls<0>)
(x) (\\ls<1>s\\ls<0>) (X) (\\ls<1>S\\ls<0>)
(w) (\\ls<1>u\\ls<0>) (W) (\\ls<1>U\\ls<0>)
(--) (-\\t<-12>-\\t<0>) (---) (-\\t<-12>--\\t<0>)
(...) (.\\t<-8>..\\t<0>)
] def
%===========================================
%===== BEGIN DEFINITION OF PROCEDURES ======
%===========================================
/stringSplice % assumes (Right) (Left)
{ dup length % (Right) (Left) LLength
dup % (Right) (Left) LLength LLength
3 1 roll % (Right) LLength (Left) LLength
3 index length % (Right) LLength (Left) LLength RLength
add % (Right) LLength (Left) TotLength
string % (Right) LLength (Left) (---------)
copy % (Right) LLength (Left-----)
/splice exch def % (Right) LLength
splice % (Right) LLength splice
3 1 roll exch % splice (Right) LLeft
putinterval % stack empty...
splice % splice
} bind def % ...splice = (LeftRight)
%==== NEW PROCEDURE ====
/rootOut % assumed are... (bad) (good) (input)
{ % def
{ % loop
2 index % (bad) (good) (input) (bad)
search % (bad) (good) (post) (bad) (pre) true
% (bad) (good) (input) false
dup {/trovis true def} if
{ % ifelse
exch pop % (bad) (good) (post) (pre)
2 index % (bad) (good) (post) (pre) (good)
exch % (bad) (good) (post) (good) (pre)
stringSplice % (bad) (good) (post) (pregood) & splice = (pregood)
stringSplice % (bad) (good) (pregoodpost) & splice = (pregoodpost)
}{ % ifelse
3 1 roll % (pregoodpost) (bad) (good)
pop pop % (pregoodpost)
exit % ...break out of loop
} ifelse
} loop % go back for next (bad)
} bind def
%==== NEW PROCEDURE ====
/swapOut % assumed is... (input)
{ % def
dup % (input) (input)
(mvx) search % (input) (post) (mvx) (pre) true
% (input) (input) false
{ 3 1 roll % (input) (pre) (post) (mvx)
pop pop % (input) (pre)
outfile exch
writestring
( mvx\n)
outfile exch % (input)
writestring % put back the integer and "mvx"
}{ % ifelse
pop % (input)
} ifelse % ifelse
mark exch % mark (input)
swapArray % mark (input) [ () ()...]
length % mark (input) int
/longo exch def % mark (input)
swapArray % mark (input [ () ()...]
aload pop % mark (input) () ()
longo 1 add % mark (input) () () int
-1 roll % mark () () (input)
longo 2 div cvi % mark () () (input) int
{ % repeat
dup % mark (good) (bad) (input) (input)
4 1 roll % mark (input) (good) (bad) (input)
exch % mark (input) (good) (input) (bad)
search % mark (input) (good) (post) (bad) (pre) true
% mark (input) (good) (input) false
{ % ifelse
4 -1 roll % mark (input) (post) (bad) (pre) (good)
outfile
exch
writestring % write substitution string to file
cleartomark % stack empty
exit % break out of loop
}{ % ifelse
pop pop % (input)
} ifelse
} repeat % go back for next (bad)
} bind def
%==== NEW PROCEDURE ====
/rootOutAll % assumed is... (input)
{ % def
swapArray % (input) [(bad) (good)...]
dup length % (input) [(b)(g)] int
/longo exch def % (input) [(b)(g)]
aload pop % (input) (b) (g)
longo 1 add % (input) (b) (g) int
-1 roll % (b) (g) (input)
longo 2 div cvi {rootOut} % ...search and replace entire input string.
repeat % (output)
} bind def
%==== NEW PROCEDURE ====
/setFiles % assumed is (HD:Name.txt) or (HD:Name.ps)
{ % def
/ps? false def % initialize the flags
/txt? false def
/mytxt? false def
/myps? false def
(\nChecking for proper suffix on input file... ) print flush
dup print flush
dup % (HD:Name.--) (HD:Name.--)
/infile exch (r) file def % (HD:Name.--)
(.) search % (-) (.) (HD:Name) true
% (HD:Name) false
{ % ifelse true case assumes (-) (.) (HD:Name)
3 1 roll % (HD:Name) (-) (.)
pop % (HD:Name) (-)
% stack ready to compare suffixes
dup % (HD:Name) (-) (-)
(txt) eq % (HD:Name) (-) bool
{ % if
(.fmtd) % (HD:Name) (-) (.fmtd)
/txt? true def % set flag
} if % if
dup % (HD:Name) (-) (-)
(ps) eq % (HD:Name) (-) bool
{ % if
(.Eo-ps) % (HD:Name) (-) (.Eo-ps)
/ps? true def
} if
dup % (HD:Name) (-) (-)
(mytxt) eq % if
{ % (HD:Name) (-) bool
(.my-txt) % (HD:Name) (-) (.mytxt)
/mytxt? true def % set fllag
} if % if
dup % (HD:Name) (-) (-)
(myps) eq % (HD:Name) (-) bool
{ % if
(.my-ps) % (HD:Name) (-) (.my-ps)
/myps? true def % set flag
} if % if
3 -1 roll % (-) (.suffix) (HD:Name)
stringSplice % (-) (HD:Name.suffix)
dup % (-) (HD:Name.suffix) (HD:Name.suffix)
/outfile exch (w) file def % (-) (HD:Name.suffix)
(\nThe name of your output file will be......... ) print flush
print flush % (-)
myps? mytxt? or ps? or txt? or not
{ (\n\nERROR -- UNKNOWN SUFFIX ON INPUT FILE !
Input file suffix was...) print flush dup print flush % prints suffix name
(\n) print flush % new line on screen
} if % if
pop % empty stack
}{ % ifelse false case assumes (HD:Name)
(\n\n ERROR -- NO SUFFIX ON INPUT FILE !
Input file name was... ) print flush print flush % prints file name
(\n) print flush % new line on screen
} ifelse % ifelse, stack empty
/ujo 1024 string def % ujo is a holder for read strings
} def
%===== New Procedure =====
/editProlog
{ %def
{ %loop
infile ujo
readline not
{ (\n\n"%%EndProlog" MISSING FROM INPUT FILE.
Could not perform prolog insertion!\n \
Check contents of input file.\n) print flush
exit
} if
dup
(%%EndProlog) eq
{ (\n\nFound "%%EndProlog" comment. \n) print flush
pop
swapArray {outfile exch writestring} forall
(Prolog insertion successful. \n) print flush
exit
} if
( \n) exch stringSplice
outfile exch writestring
} bind loop
} def
%===== New Procedure =====
/editNonProlog
{ %def
(\nBusy editing page descriptions.\n) print flush
{ %loop
infile ujo
readline not
{ infile outfile currentfile
3 {closefile} repeat
exit
} if
dup
(-1.041 mvy) ne % baseline shift marker
{
(deffon) search % (t) (deffon) (pre) true
% (input) false
{ outfile exch writestring % write in the (pre)
pop pop % throw out (deffon) and (t)
outfile (newdeffont \n) writestring
}{ % ifelse
outfile exch writestring
outfile (\n) writestring
} ifelse
}{ % ifelse
pop
infile ujo readline
not { (\n\nERROR... a "-1.041 mvy" found out of place
) print flush} if
swapOut
infile ujo readline % read and discard the "0.000 mvy"
pop
} ifelse
} bind loop
(\nAll done. Ready for next operation.\n\n) print flush
} def
%===== New Procedure =====
/editOther
{ %def
{ %loop
infile ujo
readline
{ %ifelse
( \n) exch stringSplice
rootOutAll
outfile exch writestring
}{ %ifelse
( \n) exch stringSplice
rootOutAll
outfile exch writestring
infile closefile
outfile closefile
exit
} ifelse % ifelse
} bind loop
} def
%%EndProlog
setFiles
ps? { /swapArray fadenArray def editProlog
/swapArray psArray def editNonProlog
} if
txt? { /swapArray txtArray def editOther } if
myps? { /swapArray prologArray def editProlog
/swapArray nonPrologArray def editNonProlog
} if
mytxt? { /swapArray otherArray def editOther } if
(\n\nAll done. Ready for next operation.\n\n) print flush