home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
printers
/
utilities
/
redaktu
/
redaktu.bak
< prev
next >
Wrap
Text File
|
1991-02-14
|
12KB
|
367 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
%===========================================
%==== ARRAY "newArray" IS FOR USE IN =======
%==== FILES HAVING UNEXPECTED OR =======
%==== ABSENT SUFFIXES =======
%===========================================
/newArray [ ( remove ) ( insert ) ] def
%====================================================
%===== 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
/breve
{ pop 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
/BREVE
{ pop 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
/SCircum
{ pop 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 (
/sCircum
{ pop 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
/CCircum
{ pop 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
/cCircum
{ pop 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 (
/GCircum
{ pop 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
/gCircum
{ pop 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
/JCircum
{ pop 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 (
/jCircum
{ pop 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
/HCircum
{ pop 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
/hCircum
{ pop 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
[ ( deffont ) ( newdeffont \n [)
( mvx (c) show) ( cCircum \n [)
( mvx (C) show) ( CCircum \n [)
( mvx (j) show) ( jCircum \n [)
( mvx (J) show) ( JCircum \n [)
( mvx (g) show) ( gCircum \n [)
( mvx (G) show) ( GCircum \n [)
( mvx (h) show) ( hCircum \n [)
( mvx (H) show) ( HCircum \n [)
( mvx (s) show) ( sCircum \n [)
( mvx (S) show) ( SCircum \n [)
( mvx (U) show) ( BREVE \n [)
( mvx (u) show) ( breve \n [)
] def % psArray defined
%=======================================================
%===== DEFINE THE ARRAY OF SEARCH/REPLACE STRINGS =====
%===== FOR USE IN .txt FILES ONLY =====
%=======================================================
/txtArray [ (q) (c\\t<-44>c\\t<0>) (Q) (C\\t<-67>C\\t<0>)
([) (g\\t<-50>g\\t<0>) ({) (G\\t<-72>G\\t<0>)
(]) (h\\t<-50>h\\t<0>) (}) (H\\t<-72>H\\t<0>)
(y) (j\\t<-28>j\\t<0>) (Y) (J\\t<-39>J\\t<0>)
(x) (s\\t<-39>s\\t<0>) (X) (S\\t<-56>S\\t<0>)
(w) (u\\t<-50>u\\t<0>) (W) (U\\t<-72>U\\t<0>)
(--) (-\\t<-10>-\\t<0>) (---) (-\\t<-10>--\\t<0>)
(...) (.\\t<10>..\\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 ====
/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 ====
/autoEdit % assumed is (HD:Name.txt) or (HD:Name.ps)
{ % 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
2 index
(txt) eq
{ 3 1 roll % if... (HD:Name) (--) (.)
pop pop % (HD:Name)
(.fmtd) exch % (.fmtd) (HD:Name)
stringSplice % (HD:Name.fmtd)
dup % (HD:Name.fmtd) (HD:Name.fmtd)
/outfile exch % (HD:Name.fmtd)
(w) file def % (HD:Name.fmtd)
/swapArray txtArray def % choose set of exchanges for .txt
/ps? false def % (HD:Name.fmtd)
} % ifelse
{
2 index
(ps) eq
{ 3 1 roll % (HD:Name) (ps) (.)
pop pop % (HD:Name)
(.Eo-ps) exch % (HD:Name.Eo-ps) (HD:Name.Eo-ps)
stringSplice
dup
/outfile exch % (HD:Name.Eo-ps)
(w) file def % (HD:Name.Eo-ps)
/swapArray psArray def % choose set of exchanges for .ps
/ps? true def % (HD:Name.Eo-ps)
} % ifelse
{
3 1 roll
pop pop
(.edtd) exch
stringSplice
dup
/outfile exch
(w) file def
/swapArray newArray def
/ps? false def
(\n\nUnexpected suffix on input file name.
Therefor, "newArray" will be used for all search/replace's.\n)
print flush
} ifelse
} ifelse
}
{
(.new) exch stringSplice
dup
/outfile exch
(w) file def
/swapArray newArray def
/ps? false def
(\n\nNo suffix on input file name.
Therefor, "newArray" will be used for all search/replace's.)
print flush
} ifelse % ifelse
(\n\nThe name of your output file will be... ) print flush
print flush
/ujo 1024 string def
/trovis false def
ps? {
{ %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
fadenArray {outfile exch writestring} forall
(Prolog insertion successful. \n) print flush
exit
} if
( \n) exch stringSplice
outfile exch writestring
} bind loop
} if
(\nBusy editing. Please be patient.\n) print flush
{ %loop
infile ujo
readline
{ %ifelse
( \n) exch stringSplice
rootOutAll
ps? { trovis { (] pop \n) exch stringSplice } if }if
outfile exch writestring
}{ %ifelse
( \n) exch stringSplice
rootOutAll
ps? { trovis { (] pop \n) exch stringSplice } if }if
outfile exch writestring
infile closefile
outfile closefile
exit
} ifelse % ifelse
/trovis false def
} bind loop
} def
%%EndProlog
autoEdit % Assumes (HD:Name.ps) or (HD:Name.txt)
(\nAll done. Ready for next operation.\n\n) print flush