%!ps % Demo a file read table_builder1 % ======= % Author and date % Function % Details % ====== % Postscript demo to generate css compatible $20 URL space % Intended primarily for study as this was an internal workfile. % Requires gonzo, gonzotut, and several older files relocated. % Requires //acrodist /F from command line. % Cut and paste .txt generated code from chrome, not wordpad. % ======= % Uncomment and modify to use disk based Gonzo. ( or other disk access ) (C:/Users/Don/Desktop/Ghost/gonzo.psl) run % use internal /guru { gonzo begin ps.util.1 begin printerror nuisance begin} def guru % activate gonzo utilities % ============================== /fileprefix (C:/Users/don/Desktop/Web/url_nospace/) store % the file prefix /infilename (whtnu15.shtml) store /outfilename (whtnu15rebuild.shtml) store /startarray [ ] store /endarray [ ] store /ststr () store fileprefix infilename mergestr (r) file /nf exch store fileprefix outfilename mergestr (w) file /nfd exch store %%% findstart stashes the start and end filepositions for each url to be processed /findstart { /endfile false store 2000000 { /endfile false store nf 9 string readstring { () eq { nf fileposition /cur exch store mark endarray aload pop cur 1 sub ] /endarray exch store exit } if } { pop /endfile true store exit} ifelse % got to end nf fileposition 1 sub nf exch setfileposition } repeat } store /fixspaces {/newurl () store /bool exch store % dup print 50 { ( ) search { (%20) mergestr newurl exch mergestr /newurl exch store pop % erase old space!!! % (\n\n newurl is now -------------> ) print newurl == } { newurl exch mergestr /newurl exch store exit } ifelse } repeat newurl % dup print (\n\n) print bool } store % %%%%%%%% demo- modify for actual use %%%%% stopwatchon findstart stopwatchoff nf closefile % startarray length == startarray == % endarray length == endarray == startarray length endarray length eq {(\n\nArray lengths agree at ) endarray length 20 string cvs mergestr (!!\n\n) mergestr print} {(\n\nArray lengths mismatch! CHECK ORIGINAL OR CODE PROBLEM!!\n\n) print} ifelse (\n\n) print % file writing demo fileprefix infilename mergestr (r) file /nf exch store fileprefix outfilename mergestr (w) file /nfd exch store stopwatchon nf startarray 0 get string readstring { nfd exch writestring}{pop exit} ifelse 0 1 endarray length 2 sub {/curpos exch store nf endarray curpos get startarray curpos get sub string readstring fixspaces { nfd exch writestring}{pop exit} ifelse nf startarray curpos 1 add get endarray curpos get sub string readstring { nfd exch writestring}{pop exit} ifelse } for { nf endarray length 1 sub get % last url startarray length 1 sub get sub string readstring { nfd exch writestring}{pop exit} ifelse } pop nf 10000 string readstring {bad_ending!}{ nfd exch writestring } ifelse % past last url stopwatchoff nfd closefile (\n\n) print (\n\n) print %EOF