%! % Fake PostScript Log generator % Any unmodified Google Drive appears to generate an error on % any PostScript program whose primary output is a log file. Such programs % are enormously useful when using PostScript to generate % code in most any other language. % Log files can be faked by diverting their new intended code % generation to the main .PDF program. In this example, there % is no other .pdf intended output. % This simple example only accepts single text lines. % ///////// (A) WEB FRIENDLY COLOR UTILITIES ///////////// % tintmat is a self-generating list of 216 triple color values /webtintmat [ 0 1 5 { /a exch store 0 1 5 { /b exch store 0 1 5 { 5 div b 5 div a 5 div }for } for } for ] def % setwebtint accepts a color number 0 to 215 and then % sets the PostScript color generator for later use... /setwebtint { abs cvi 216 cvi mod % restrict range webtintmat exch 3 mul 3 getinterval % get values from table aload pop setrgbcolor} def % and set them % The blocks are arranged as red to the right, green % up in order of increasing blue. % Some "pure color" sequences are % red: 0 1 2 3 4 5 % orange: 0 7 8 15 16 23 (sort of) % yellow: 0 7 14 21 28 35 % green: 0 6 12 18 24 30 % aqua: 0 42 84 126 168 210 % blue: 0 36 72 108 144 180 % magenta: 0 37 74 111 148 185 % purple 0 73 73 110 147 183 (sort of) % gray 0 43 86 129 172 215 % ////////////// GONZO EXCERPTS ////////////////// /setgrid { /blocksize exch def translate % simplified blocksize dup scale} def % repeats [ proc distance trips] xrpt /xrpt{gsave aload pop /trips exch def /dist exch def /rproc exch def trips { gsave rproc grestore dist 0 translate } repeat grestore} def /yrpt{gsave aload pop /trips exch def /dist exch def /rproc exch def trips { gsave rproc grestore 0 dist translate } repeat grestore} def % mergestr merges the two top stack strings into one top stack string /mergestr {2 copy length exch length add string dup dup 4 3 roll 4 index length exch putinterval 3 1 roll exch 0 exch putinterval} def /showgrid {gsave /vblocks exch def /hblocks exch def thingridlines setlinewidth [{0 0 moveto 0 vblocks rlineto stroke} 1 hblocks 1 add] xrpt [{0 0 moveto hblocks 0 rlineto stroke} 1 vblocks 1 add] yrpt fatterborder { gsave newpath 0 0.96 blocksize div dtransform round idtransform setlinewidth pop 2 setlinecap 0 0 moveto hblocks 0 rlineto 0 vblocks rlineto hblocks neg 0 rlineto closepath stroke grestore} if fat5 { gsave newpath 0 0.48 blocksize div dtransform round idtransform setlinewidth pop mark {5 0 moveto 0 vblocks rlineto stroke} 5 hblocks 5 div cvi] xrpt mark {0 5 moveto hblocks 0 rlineto stroke} 5 vblocks 5 div cvi] yrpt grestore} if fatter10 { gsave newpath 0 0.96 blocksize div dtransform round idtransform setlinewidth pop mark {10 0 moveto 0 vblocks rlineto stroke} 10 hblocks 10 div cvi] xrpt mark {0 10 moveto hblocks 0 rlineto stroke} 10 vblocks 10 div cvi] yrpt grestore} if grestore} def /fatterborder {true } store /fat5 {false} store /fatter10 { false} store /thingridlines {0} def % /////// LOGFILE EMULATOR ////////////// /showtext {/curline exch store % save the string xpos ypos moveto curline show % and image it /xpos currentpoint pop store % move right if no linefeed curline dup length 1 sub get 10 eq % ends with LF? {/ypos ypos 1 sub store /xpos 3 store } if % continue on present line curline length 1 eq { curline 0 get 10 eq % a "naked" LF for blocks? {ypos 10 lt { % new page if not enough room showpage 50 50 10 setgrid % prefer to work 10x + Gonzo showthegrid {32 setwebtint gridwide gridhigh showgrid 0 setwebtint} if /ypos gridhigh 1 sub store /xpos 3 store } if } if } if } store /print {showtext} def /nextline { /ypos ypos 1 sub store} store /showthegrid true store /gridwide 53 store /gridhigh 68 store /xpos 3 store /ypos gridhigh 1 sub store /yinc 1 store 50 50 10 setgrid % prefer to work 10x + Gonzo showthegrid {32 setwebtint gridwide gridhigh showgrid 0 setwebtint } if % optionally show grid % Fonts will be substituted unless specific to acrobat, ghostscript, google /StoneSans-Bold findfont 1 scalefont setfont % Use more Gonzo if >1 font needed /blocksperpage {6} store % optional full paragraph forcer % /////////// CODE TO BE LOG FILE FAKED GOES BELOW HERE //////////// % This is a .SHTML revision example /yrfull (2001) store /yr2 (01)store /mofull [(January)(February)(March)(April)(May)(June)(July)(August)(September)(October)(November)(December)] store /mo2 [(31)(28)(31)(30)(31)(30)(31)(31)(30)(31)(30)(31)] store /buildhead {11 -1 0 { /curmo exch store mofull curmo get /curmofull exch store % get current month mo2 curmo get cvi -1 1 {3 string cvs /curday exch store % get current day buildheadx } for (\n) print % month break } for } store /buildheadx { % deeplink marker (\n) print( \n) print % deeplink table % beware of PS hex (\n)print ( \n) print ( ) print curmofull print ( ) print % print full month curday print (, ) print yrfull print ( \n) print % href link ( \n) print () print (\n deeplink   top\n) print (\n   bot   \n) print (\n respond\n) print (\n\n) print (\n) print } store % This is an example of each day's intended format % { % % % % % % %
March 31, 2019deeplink   top %   bot   respond
%
%